aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-01-17 12:35:04 (UTC)
committerjan <jan@ruken.pw>2016-01-17 12:35:04 (UTC)
commit912144bed682b982bb2f01e77444832aa52e2556 (patch)
tree6619b5d2061240cde0bb3416e39c5496f405c016
parent4f731893bf5bcb812c43da009773b0079b0aeee3 (diff)
highlighting in der instantsuche verbessert.
-rw-r--r--assets/js/search.js3
-rw-r--r--views/instant_search_results.html2
2 files changed, 3 insertions, 2 deletions
diff --git a/assets/js/search.js b/assets/js/search.js
index a6cc1f4..0cb33df 100644
--- a/assets/js/search.js
+++ b/assets/js/search.js
@@ -26,7 +26,8 @@ function doSearch() {
26 document.getElementById("search-results").innerHTML = ""; 26 document.getElementById("search-results").innerHTML = "";
27 return; 27 return;
28 } 28 }
29 document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('>' + value + '</span>', 'gi'), "><b>" + value + "</b></span>"); 29
30 document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('{ (.*?)(' + value + ')(.*?) }', 'gi'), "$1<b>$2</b>$3").replace(new RegExp('{ (.*?) }', 'gi'), '$1');
30 } 31 }
31 } 32 }
32 xhr.open('GET', '/search/gril_instant/' + value, true); 33 xhr.open('GET', '/search/gril_instant/' + value, true);
diff --git a/views/instant_search_results.html b/views/instant_search_results.html
index 914b271..0dd445c 100644
--- a/views/instant_search_results.html
+++ b/views/instant_search_results.html
@@ -2,7 +2,7 @@
2{{ range .results }} 2{{ range .results }}
3<li class="collection-item search-result avatar hoverable valign-wrapper" onClick="clickSearchResult({{ .ID }})" > 3<li class="collection-item search-result avatar hoverable valign-wrapper" onClick="clickSearchResult({{ .ID }})" >
4 <img src="/{{ .ImagePath }}" alt="" class="circle"> 4 <img src="/{{ .ImagePath }}" alt="" class="circle">
5 <span class="title valign">{{ .Name }}</span> 5 <span class="title valign">{ {{ .Name }} }</span>
6</li> 6</li>
7{{ end }} 7{{ end }}
8{{ end }} \ No newline at end of file 8{{ end }} \ No newline at end of file