Compare commits

..

No commits in common. "4c7590a212c3900b6f6bf37d00afd6a0c72b84b3" and "9028fc646de7497cb4d321320f0d2ddc52bdf2e0" have entirely different histories.

View File

@ -184,7 +184,7 @@ function jump_to(latlng, zoom = -1) {
if (zoom == -1) if (zoom == -1)
zoom = mymap.getZoom(); zoom = mymap.getZoom();
if (!editor_mode) if (!editor_mode)
document.location.hash = "#" + Math.round(latlng.lng) + "," + Math.round(latlng.lat) + "," + zoom; document.location.hash = "#" + Math.round(latlng.lat) + "," + Math.round(latlng.lng) + "," + zoom;
else else
mymap.setView(latlng, zoom); mymap.setView(latlng, zoom);
} }
@ -235,7 +235,6 @@ 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++) {
@ -249,7 +248,7 @@ function search(e) {
regex = new RegExp(query, 'i'); regex = new RegExp(query, 'i');
if (item.feature.properties.name.match(regex)) { if (item.feature.properties.name.match(regex)) {
el = document.createElement("li"); 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="javascript:layers._layers[' + i + '].layer._layers[' + item._leaflet_id + '].fire(\'click\') ">' + item.feature.properties.name + "</a>";
results.appendChild(el); results.appendChild(el);
} }
break; break;
@ -258,9 +257,10 @@ 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({