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', 'key-ui');
20 .attr('class', 'sidebar_heading')
24 .text(I18n.t('javascripts.close'))
25 .attr('class', 'sidebar_close')
27 .bind('click', toggle))
30 .text(I18n.t('javascripts.key.title')));
32 var $section = $('<section>')
35 options.sidebar.addPane($ui);
42 map.on('zoomend baselayerchange', update);
43 $section.load('/key', update);
47 map.off('zoomend baselayerchange', update);
53 options.sidebar.togglePane($ui);
57 var layer = map.getMapBaseLayerId(),
60 $('.mapkey-table-entry').each(function () {
61 var data = $(this).data();
62 if (layer == data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {