diff options
-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; |