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 = $('<div>')
33 .attr('class', 'section')
36 options.sidebar.addPane($ui);
43 map.on('zoomend baselayerchange', update);
44 $section.load('/key', update);
48 map.off('zoomend baselayerchange', update);
54 options.sidebar.togglePane($ui);
58 var layer = map.getMapBaseLayerId(),
61 $('.mapkey-table-entry').each(function () {
62 var data = $(this).data();
63 if (layer == data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {