From a6a4bbc9dc3a9d3e489fa0b84407d0983d58db19 Mon Sep 17 00:00:00 2001
From: Joe TS Dell <thunyathep.s@outlook.com>
Date: Fri, 30 Apr 2021 21:43:15 +0200
Subject: [PATCH] update

---
 public/index.html               | 2 +-
 public/js/add_paper.js          | 2 --
 public/js/citationSheetParse.js | 9 +++++----
 public/js/search.js             | 1 -
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/public/index.html b/public/index.html
index e8495d0..7953f03 100644
--- a/public/index.html
+++ b/public/index.html
@@ -413,7 +413,6 @@
   <script src="js/bootstrap.min.js"></script>
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/0.8.2/css/flag-icon.min.css">
   <script src="js/config.js"></script>
-  <script src="js/citationSheetParse.js"></script>
   <script src="js/language.js"></script>
   <script src="js/add_content.js"></script>
   <script src="js/add_paper.js"></script>
@@ -423,6 +422,7 @@
   <link rel="stylesheet" href="./css/search.css">
   <link rel="stylesheet" href="./css/language.css">
   <script src="js/search.js"></script>
+  <script src="js/citationSheetParse.js"></script>
 
 </body>
 
diff --git a/public/js/add_paper.js b/public/js/add_paper.js
index 065995f..0d434e3 100644
--- a/public/js/add_paper.js
+++ b/public/js/add_paper.js
@@ -7,7 +7,6 @@ function addpaper(item) {
 
     var authors = "";
     for (var i = 0; i < item.item.authors.length; i++) {
-      console.log(i);
       authors += item.item.authors[i].lastName + ", " + item.item.authors[i].firstName.substring(0, 1) + "., "
       //Do something
     }
@@ -15,7 +14,6 @@ function addpaper(item) {
     // check if there is keywords in item
     if (item.item.keywords !== undefined) {
       for (var i = 0; i < item.item.keywords.length; i++) {
-        console.log(i);
         keywords += '<span class="badge badge-pill badge-light">' + item.item.keywords[i] + '</span>'
         //Do something
       }
diff --git a/public/js/citationSheetParse.js b/public/js/citationSheetParse.js
index 28f8b2a..5f73cae 100644
--- a/public/js/citationSheetParse.js
+++ b/public/js/citationSheetParse.js
@@ -158,13 +158,15 @@ var load_excel_citation = function (cb) {
                 "}}"
     
             jsonContent.push(item);
-    
+            if (i == jsonOutput.length - 1) {
+                cb() // callback
+            }
         }
         // console.log(jsonContent);
-    
+        
     }
     xmlHttpRequest.send();
-    cb() // callback
+    
 }
 
 // get paper from the Sabo result
@@ -176,7 +178,6 @@ load_excel_citation(function () {
     for (var i = 0; i < arrayLength; i++) {
 
         if (Math.abs(arrayLength - i) <= max_paper_list) {
-            console.log("close to " + i)
             addpaper(stuff_paper[i]);
         }
         //Do something
diff --git a/public/js/search.js b/public/js/search.js
index 6c597e2..d4b7575 100644
--- a/public/js/search.js
+++ b/public/js/search.js
@@ -159,7 +159,6 @@ function searchToggle_paper(obj, evt) {
         var arrayLength = stuff_paper.length;
         for (var i = 0; i < arrayLength; i++) {
             if (Math.abs(arrayLength - i) <= 2) {
-                console.log("close to " + i)
                 addpaper(stuff_paper[i]);
             }
 
-- 
GitLab