diff options
author | jan <jan@ruken.pw> | 2016-01-16 22:17:42 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2016-01-16 22:17:42 (UTC) |
commit | 890b00d31ad2123613081fa45a0bafdc27570c57 (patch) | |
tree | 1b1a294001c34c482e72e9dc1a86b14b643d1e33 /assets/js | |
parent | 8a3d109c3d0903851605cdac7ab7a3b10716962e (diff) |
wir wollen nur die tatsächliche value auswechseln, nicht die html tags
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/search.js | 7 |
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); |