1 L.OSM.key = function (options) {
2 var control = L.OSM.sidebarPane(options, "key", null, "javascripts.key.title");
4 control.onAddPane = function (map, button, $ui) {
5 var $section = $("<div>")
6 .attr("class", "section")
13 map.on("baselayerchange", updateButton);
18 map.on("zoomend baselayerchange", update);
19 $section.load("/key", update);
23 map.off("zoomend baselayerchange", update);
26 function updateButton() {
27 var disabled = OSM.LAYERS_WITH_MAP_KEY.indexOf(map.getMapBaseLayerId()) === -1;
29 .toggleClass("disabled", disabled)
30 .attr("data-bs-original-title",
32 "javascripts.key.tooltip_disabled" :
33 "javascripts.key.tooltip"));
37 var layer = map.getMapBaseLayerId(),
40 $(".mapkey-table-entry").each(function () {
41 var data = $(this).data();
43 layer === data.layer &&
44 (!data.zoomMin || zoom >= data.zoomMin) &&
45 (!data.zoomMax || zoom <= data.zoomMax)