From f88c7b78f224bf746b831001ec8cef01693a4b3c Mon Sep 17 00:00:00 2001
From: amzrk2
Date: Tue, 16 Jun 2020 16:09:04 +0800
Subject: Search page i18n

---
 assets/js/fuji.js                     | 14 ++++++++------
 assets/scss/_fuji-style/_content.scss |  7 ++++++-
 2 files changed, 14 insertions(+), 7 deletions(-)

(limited to 'assets')

diff --git a/assets/js/fuji.js b/assets/js/fuji.js
index bf9eabc..14d63bc 100644
--- a/assets/js/fuji.js
+++ b/assets/js/fuji.js
@@ -105,7 +105,7 @@ function searchAll(key, index, counter) {
         ],
     });
     let result = fuse.search(key);
-    console.log(result);
+    // console.log(result);
     if (result.length > 0) {
         document.getElementById('search-result').innerHTML = template('search-result-template', result);
         return [new Date().getTime() - counter, result.length];
@@ -124,16 +124,19 @@ if (urlParams.has('s')) {
     let xhr = new XMLHttpRequest();
     xhr.open('GET', '/index.json', true);
     xhr.responseType = 'json';
-    xhr.onerror = (e) => {
+    xhr.onerror = () => {
         infoElements[2].removeAttribute('style');
     };
-    xhr.onload = () => {
+    xhr.ontimeout = () => {
+        infoElements[2].removeAttribute('style');
+    };
+    xhr.onreadystatechange = () => {
         if (xhr.readyState === 4) {
             if (xhr.status === 200) {
                 // use index json to search
-                console.log(xhr.response);
+                // console.log(xhr.response);
                 counter = searchAll(key, xhr.response, counter);
-                console.log(counter);
+                // console.log(counter);
                 if (counter === 'notFound') {
                     infoElements[1].removeAttribute('style');
                 } else {
@@ -142,7 +145,6 @@ if (urlParams.has('s')) {
                     infoElements[0].removeAttribute('style');
                 }
             } else {
-                console.error(`Failed to get index.json, ${xhr.status} ${xhr.statusText}`);
                 infoElements[2].removeAttribute('style');
             }
         }
diff --git a/assets/scss/_fuji-style/_content.scss b/assets/scss/_fuji-style/_content.scss
index 10003ef..2cfd184 100644
--- a/assets/scss/_fuji-style/_content.scss
+++ b/assets/scss/_fuji-style/_content.scss
@@ -187,8 +187,13 @@ article {
 
     button {
         flex: 0 1 auto;
-        padding: 0 0.75rem;
+        padding: 0 0.5rem;
         word-break: keep-all;
         height: 2.5rem;
+
+        ion-icon {
+            height: 100%;
+            font-size: 1.6rem;
+        }
     }
 }
-- 
cgit v1.2.3