1 $(document).ready(function () {
2 $("#open_map_key").click(function (e) {
3 var url = $(this).attr('href'),
4 title = $(this).text();
6 function updateMapKey() {
7 var mapLayer = map.baseLayer.keyid,
8 mapZoom = map.getZoom();
10 $(".mapkey-table-entry").each(function () {
11 var entryLayer = $(this).attr("data-layer"),
12 entryZoomMin = parseInt($(this).attr("data-zoom-min")),
13 entryZoomMax = parseInt($(this).attr("data-zoom-max"));
15 if (mapLayer == entryLayer &&
16 mapZoom >= entryZoomMin && mapZoom <= entryZoomMax) {
24 $("#sidebar_content").load(url, updateMapKey);
26 openSidebar({ title: title });
28 $("#sidebar").one("closed", function () {
29 map.events.unregister("zoomend", map, updateMapKey);
30 map.events.unregister("changelayer", map, updateMapKey);
33 map.events.register("zoomend", map, updateMapKey);
34 map.events.register("changelayer", map, updateMapKey);