1 L.OSM.key = function (options) {
2 var control = L.control(options);
4 control.onAdd = function (map) {
5 var $container = $('<div>')
6 .attr('class', 'control-key');
9 .attr('class', 'control-button')
11 .attr('title', I18n.t("javascripts.key.tooltip"))
12 .html('<span class="icon key"></span>')
14 .appendTo($container);
17 .attr('class', 'layers-ui')
18 .appendTo(options.uiPane);
21 .text(I18n.t('javascripts.key.title'))
24 var $section = $('<section>')
31 var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
33 if ($ui.is(':visible')) {
34 $(options.uiPane).hide();
35 controlContainer.css({paddingRight: '0'});
36 map.off("zoomend baselayerchange", update);
38 $(options.uiPane).show();
39 controlContainer.css({paddingRight: '200px'});
40 map.on("zoomend baselayerchange", update);
41 $section.load('/key', update);
46 var mapLayer = getMapBaseLayerId(map),
47 mapZoom = map.getZoom();
49 $(".mapkey-table-entry").each(function () {
50 var data = $(this).data();
52 if (mapLayer == data.layer && mapZoom >= data.zoomMin && mapZoom <= data.zoomMax) {