Compare commits
3 Commits
9028fc646d
...
4c7590a212
Author | SHA1 | Date | |
---|---|---|---|
4c7590a212 | |||
e1baa251fb | |||
d1e0c3fffa |
@ -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.lat) + "," + Math.round(latlng.lng) + "," + zoom;
|
document.location.hash = "#" + Math.round(latlng.lng) + "," + Math.round(latlng.lat) + "," + zoom;
|
||||||
else
|
else
|
||||||
mymap.setView(latlng, zoom);
|
mymap.setView(latlng, zoom);
|
||||||
}
|
}
|
||||||
@ -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++) {
|
||||||
@ -248,7 +249,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="javascript:layers._layers[' + i + '].layer._layers[' + item._leaflet_id + '].fire(\'click\') ">' + 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;">' + item.feature.properties.name + "</a>";
|
||||||
results.appendChild(el);
|
results.appendChild(el);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -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({
|
||||||
|
Loading…
Reference in New Issue
Block a user