diff options
author | Markus Koch <markus@notsyncing.net> | 2020-04-20 18:40:22 +0200 |
---|---|---|
committer | Markus Koch <markus@notsyncing.net> | 2020-04-20 18:40:22 +0200 |
commit | ae47583e2d0e5ef546d6869f2ff5104f7911d68f (patch) | |
tree | 18a3ccabea00e60afb6105c292fe84545decb418 /htdocs | |
parent | cfeafc11d9b31d692730feb1813f72136756afb3 (diff) | |
download | lifomapserver-ae47583e2d0e5ef546d6869f2ff5104f7911d68f.tar.gz lifomapserver-ae47583e2d0e5ef546d6869f2ff5104f7911d68f.tar.bz2 lifomapserver-ae47583e2d0e5ef546d6869f2ff5104f7911d68f.zip |
Fix searh for terms and results including HTML chars
Diffstat (limited to 'htdocs')
-rw-r--r-- | htdocs/mapscript.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js index e450af9..8aab466 100644 --- a/htdocs/mapscript.js +++ b/htdocs/mapscript.js @@ -256,7 +256,7 @@ function polyline_get_middle_coords(coords) { var highlighted_line; var default_street_color = "#3388ff"; function search(e) { - var query = htmlEntities(document.getElementById("search_query").value); + var query = document.getElementById("search_query").value; document.getElementById('search_results').innerHTML = ""; if (query.length > 0 || e.key == "Enter") { results = document.createElement("ul"); @@ -271,7 +271,7 @@ function search(e) { regex = new RegExp(query, 'i'); if (item.feature.properties.name.match(regex)) { el = document.createElement("li"); - el.innerHTML = "[" + layers._layers[i].name + "] " + '<a href="#" onclick="layers._layers[' + i + '].layer._layers[' + item._leaflet_id + '].fire(\'click\'); return false;">' + item.feature.properties.name + "</a>"; + el.innerHTML = "[" + layers._layers[i].name + "] " + '<a href="#" onclick="layers._layers[' + i + '].layer._layers[' + item._leaflet_id + '].fire(\'click\'); return false;">' + htmlEntities(item.feature.properties.name) + "</a>"; results.appendChild(el); } break; @@ -283,12 +283,11 @@ function search(e) { regex = new RegExp(query, 'i'); if (item.feature.properties.name.match(regex)) { - console.log(item.options.color); item.options.color = "#FF0000"; item.redraw(); el = document.createElement("li"); zpos = polyline_get_middle_coords(item.feature.geometry.coordinates); - el.innerHTML = "[" + layers._layers[i].name + "] " + '<a href="#" onclick="latLng2 = L.latLng(' + zpos[1] + ',' + zpos[0] + '); jump_to(latLng2); return false;">' + item.feature.properties.name + "</a>"; + el.innerHTML = "[" + layers._layers[i].name + "] " + '<a href="#" onclick="latLng2 = L.latLng(' + zpos[1] + ',' + zpos[0] + '); jump_to(latLng2); return false;">' + htmlEntities(item.feature.properties.name) + "</a>"; results.appendChild(el); } break; |