summaryrefslogtreecommitdiff
path: root/htdocs/mapscript.js
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/mapscript.js')
-rw-r--r--htdocs/mapscript.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js
index 6b23688..40d48ab 100644
--- a/htdocs/mapscript.js
+++ b/htdocs/mapscript.js
@@ -528,18 +528,22 @@ mymap.on('moveend', update_hash_from_position);
mymap.on('dragstart', function () { is_user_drag = 1;});
mymap.on('keydown', function (e) { if (e.originalEvent.code.match(/Arrow.*/)) is_user_drag = 1;});
mymap.on('overlayadd', function (e) { update_street_width(); update_outline_visibility(); });
+
function onHashChange(e, hash=null) {
if (!hash)
hash = document.location.hash;
if (hash == "#" + get_current_location_str())
return; // We're already there
- coordstr = hash.slice(1).replace(/%20/g, "").split(",");
+ coordstr = decodeURIComponent(hash.slice(1)).split(",");
if (coordstr.length < 2)
coordstr.push(0); // Default y
if (coordstr.length < 3)
coordstr.push(mymap.getZoom()); // Default zoom
var latlng = L.latLng(parseFloat(coordstr[1]), parseFloat(coordstr[0]));
mymap.setView(latlng, parseInt(coordstr[2]));
+ if (coordstr.length > 3) { /* Drop named marker */
+ foo = L.marker(latlng).bindPopup(htmlEntities(coordstr[3])).addTo(mymap).openPopup();
+ }
}
window.addEventListener("hashchange", onHashChange, false);