summaryrefslogtreecommitdiffstats
path: root/static/assets/js/fuji.min.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/assets/js/fuji.min.js')
-rw-r--r--static/assets/js/fuji.min.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/static/assets/js/fuji.min.js b/static/assets/js/fuji.min.js
index 295ee61..6b0646d 100644
--- a/static/assets/js/fuji.min.js
+++ b/static/assets/js/fuji.min.js
@@ -95,8 +95,7 @@ function searchAll(key, index, counter) {
weight: 1.0
}]
});
- var result = fuse.search(key);
- console.log(result);
+ var result = fuse.search(key); // console.log(result);
if (result.length > 0) {
document.getElementById('search-result').innerHTML = template('search-result-template', result);
@@ -119,17 +118,20 @@ if (urlParams.has('s')) {
xhr.open('GET', '/index.json', true);
xhr.responseType = 'json';
- xhr.onerror = function (e) {
+ xhr.onerror = function () {
infoElements[2].removeAttribute('style');
};
- xhr.onload = function () {
+ xhr.ontimeout = function () {
+ infoElements[2].removeAttribute('style');
+ };
+
+ xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
// use index json to search
- console.log(xhr.response);
- counter = searchAll(key, xhr.response, counter);
- console.log(counter);
+ // console.log(xhr.response);
+ counter = searchAll(key, xhr.response, counter); // console.log(counter);
if (counter === 'notFound') {
infoElements[1].removeAttribute('style');
@@ -139,7 +141,6 @@ if (urlParams.has('s')) {
infoElements[0].removeAttribute('style');
}
} else {
- console.error("Failed to get index.json, ".concat(xhr.status, " ").concat(xhr.statusText));
infoElements[2].removeAttribute('style');
}
}