X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/71e7208a0aceccf47edce739803130096999da5d..17b18fcb816f26953a05742d2101cef99df87d30:/app/assets/javascripts/leaflet.key.js?ds=inline diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js index 238d70c5f..6a3400d34 100644 --- a/app/assets/javascripts/leaflet.key.js +++ b/app/assets/javascripts/leaflet.key.js @@ -1,21 +1,11 @@ L.OSM.key = function (options) { - var control = L.OSM.sidebarPane(options); - - control.onAdd = function (map) { - var $container = $("
") - .attr("class", "control-key"); - - var button = this.makeButton("key", null, toggle) - .appendTo($container); - - var $ui = this.makeUI("key-ui", "javascripts.key.title", toggle); + var control = L.OSM.sidebarPane(options, "key", null, "javascripts.key.title"); + control.onAddPane = function (map, button, $ui) { var $section = $("
") .attr("class", "section") .appendTo($ui); - options.sidebar.addPane($ui); - $ui .on("show", shown) .on("hide", hidden); @@ -33,15 +23,6 @@ L.OSM.key = function (options) { map.off("zoomend baselayerchange", update); } - function toggle(e) { - e.stopPropagation(); - e.preventDefault(); - if (!button.hasClass("disabled")) { - options.sidebar.togglePane($ui, button); - } - $(".leaflet-control .control-button").tooltip("hide"); - } - function updateButton() { var disabled = ["mapnik", "cyclemap"].indexOf(map.getMapBaseLayerId()) === -1; button @@ -65,8 +46,6 @@ L.OSM.key = function (options) { } }); } - - return $container[0]; }; return control;