aboutsummaryrefslogtreecommitdiff
path: root/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/search.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/assets/js/search.js b/assets/js/search.js
index a376166..a6cc1f4 100644
--- a/assets/js/search.js
+++ b/assets/js/search.js
@@ -12,6 +12,7 @@ function doSearch() {
12 12
13 if (value === "") { 13 if (value === "") {
14 strokeTimeout = null; 14 strokeTimeout = null;
15 document.getElementById("search-results").innerHTML = "";
15 return; 16 return;
16 } 17 }
17 var xhr = new XMLHttpRequest(); 18 var xhr = new XMLHttpRequest();
@@ -21,7 +22,11 @@ function doSearch() {
21 document.getElementById("search-results").innerHTML = ''; 22 document.getElementById("search-results").innerHTML = '';
22 return 23 return
23 } 24 }
24 document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp(value, 'gi'), "<b>" + value + "</b>"); 25 if (value === "") {
26 document.getElementById("search-results").innerHTML = "";
27 return;
28 }
29 document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('>' + value + '</span>', 'gi'), "><b>" + value + "</b></span>");
25 } 30 }
26 } 31 }
27 xhr.open('GET', '/search/gril_instant/' + value, true); 32 xhr.open('GET', '/search/gril_instant/' + value, true);