From 890b00d31ad2123613081fa45a0bafdc27570c57 Mon Sep 17 00:00:00 2001 From: jan Date: Sat, 16 Jan 2016 23:17:42 +0100 Subject: =?UTF-8?q?wir=20wollen=20nur=20die=20tats=C3=A4chliche=20value=20?= =?UTF-8?q?auswechseln,=20nicht=20die=20html=20tags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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() { if (value === "") { strokeTimeout = null; + document.getElementById("search-results").innerHTML = ""; return; } var xhr = new XMLHttpRequest(); @@ -21,7 +22,11 @@ function doSearch() { document.getElementById("search-results").innerHTML = ''; return } - document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp(value, 'gi'), "" + value + ""); + if (value === "") { + document.getElementById("search-results").innerHTML = ""; + return; + } + document.getElementById("search-results").innerHTML = xhr.response.replace(new RegExp('>' + value + '', 'gi'), ">" + value + ""); } } xhr.open('GET', '/search/gril_instant/' + value, true); -- cgit v0.10.1