diff options
author | amzrk2 | 2020-06-16 16:09:04 +0800 |
---|---|---|
committer | amzrk2 | 2020-06-16 16:09:04 +0800 |
commit | f88c7b78f224bf746b831001ec8cef01693a4b3c (patch) | |
tree | 20fe1c16160171228b374c8718f858946162c8af /assets | |
parent | 03750a600a71df1276ccfcc7c817de5cb86e3e9f (diff) | |
download | hugo-theme-fuji-f88c7b78f224bf746b831001ec8cef01693a4b3c.tar.gz hugo-theme-fuji-f88c7b78f224bf746b831001ec8cef01693a4b3c.tar.bz2 hugo-theme-fuji-f88c7b78f224bf746b831001ec8cef01693a4b3c.zip |
Search page i18n
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/fuji.js | 14 | ||||
-rw-r--r-- | assets/scss/_fuji-style/_content.scss | 7 |
2 files changed, 14 insertions, 7 deletions
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; + } } } |