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');
24 .attr('class', 'close-button')
26 .bind('click', toggle))
29 .text(I18n.t('javascripts.key.title')));
31 var $section = $('<section>')
34 options.sidebar.addPane($ui);
41 map.on('zoomend baselayerchange', update);
42 $section.load('/key', update);
46 map.off('zoomend baselayerchange', update);
52 options.sidebar.togglePane($ui);
56 var layer = map.getMapBaseLayerId(),
59 $('.mapkey-table-entry').each(function () {
60 var data = $(this).data();
61 if (layer == data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {