Only display search results

This commit is contained in:
Markus Koch 2020-04-19 20:21:13 +02:00
parent e1baa251fb
commit 4c7590a212

View File

@ -235,6 +235,7 @@ function htmlEntities(str) {
var regex; var regex;
function search(e) { function search(e) {
var query = htmlEntities(document.getElementById("search_query").value); var query = htmlEntities(document.getElementById("search_query").value);
document.getElementById('search_results').innerHTML = "";
if (query.length > 0 || e.key == "Enter") { if (query.length > 0 || e.key == "Enter") {
results = document.createElement("ul"); results = document.createElement("ul");
for (var i = 0; i < layers._layers.length; i++) { for (var i = 0; i < layers._layers.length; i++) {
@ -257,10 +258,9 @@ function search(e) {
} }
} }
} }
document.getElementById('search_results').innerHTML = "Search results for " + query;
document.getElementById('search_results').appendChild(results); document.getElementById('search_results').appendChild(results);
return false;
} }
return false;
} }
L.MyControl = L.Control.extend({ L.MyControl = L.Control.extend({