1 L.OSM.key = function (options) {
2 const control = L.OSM.sidebarPane(options, "key", null, "javascripts.key.title");
4 control.onAddPane = function (map, button, $ui) {
5 const $section = $("<div>")
13 map.on("baselayerchange", updateButton);
18 map.on("zoomend baselayerchange", update);
21 .then(html => { $section.html(html); })
26 map.off("zoomend baselayerchange", update);
29 function updateButton() {
30 const disabled = OSM.LAYERS_WITH_MAP_KEY.indexOf(map.getMapBaseLayerId()) === -1;
32 .toggleClass("disabled", disabled)
33 .attr("data-bs-original-title",
35 "javascripts.key.tooltip_disabled" :
36 "javascripts.key.tooltip"));
40 const layerId = map.getMapBaseLayerId(),
43 $(".mapkey-table-entry").each(function () {
44 const data = $(this).data();
46 layerId === data.layer &&
47 (!data.zoomMin || zoom >= data.zoomMin) &&
48 (!data.zoomMax || zoom <= data.zoomMax)