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');
20 .text(I18n.t('javascripts.key.title'))
23 var $section = $('<section>')
26 options.sidebar.addPane($ui);
33 map.on('zoomend baselayerchange', update);
34 $section.load('/key', update);
38 map.off('zoomend baselayerchange', update);
44 options.sidebar.togglePane($ui);
48 var layer = getMapBaseLayerId(map),
51 $('.mapkey-table-entry').each(function () {
52 var data = $(this).data();
53 if (layer == data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {