From 912144bed682b982bb2f01e77444832aa52e2556 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 17 Jan 2016 13:35:04 +0100 Subject: highlighting in der instantsuche verbessert. 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() { document.getElementById("search-results").innerHTML = ""; return; } - document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('>' + value + '', 'gi'), ">" + value + ""); + + document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('{ (.*?)(' + value + ')(.*?) }', 'gi'), "$1$2$3").replace(new RegExp('{ (.*?) }', 'gi'), '$1'); } } 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 @@ {{ range .results }}
  • - {{ .Name }} + { {{ .Name }} }
  • {{ end }} {{ end }} \ No newline at end of file -- cgit v0.10.1