X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/87e8cf3b5860509c0344cb34ee939ae73ea99c00..456d41e1897144d092f2d9a5597a6e00167bb99c:/app/assets/javascripts/index/key.js diff --git a/app/assets/javascripts/index/key.js b/app/assets/javascripts/index/key.js index 1e4138b70..9722cf4cf 100644 --- a/app/assets/javascripts/index/key.js +++ b/app/assets/javascripts/index/key.js @@ -1,10 +1,12 @@ $(document).ready(function () { $("#open_map_key").click(function (e) { + e.preventDefault(); + var url = $(this).attr('href'), title = $(this).text(); function updateMapKey() { - var mapLayer = map.baseLayer.keyid, + var mapLayer = getMapBaseLayer().keyid, mapZoom = map.getZoom(); $(".mapkey-table-entry").each(function () { @@ -24,13 +26,9 @@ $(document).ready(function () { openSidebar({ title: title }); $("#sidebar").one("closed", function () { - map.events.unregister("zoomend", map, updateMapKey); - map.events.unregister("changelayer", map, updateMapKey); + map.off("zoomend baselayerchange", updateMapKey); }); - map.events.register("zoomend", map, updateMapKey); - map.events.register("changelayer", map, updateMapKey); - - e.preventDefault(); + map.on("zoomend baselayerchange", updateMapKey); }); });