X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/00375024263970a43ea7d39e3c65dfd0f32e8869..a5f3abcbe90250e37a0850fbdf5dedbf36f19819:/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); }); });