X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8a02bd67d9d20c4a6b01b58e88b8d65163a3798e..dbe84a97bf48789e0f32a185f701840fc68063bd:/app/assets/javascripts/leaflet.key.js diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js index 46c4661d2..6a3400d34 100644 --- a/app/assets/javascripts/leaflet.key.js +++ b/app/assets/javascripts/leaflet.key.js @@ -1,25 +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 = $("") - .attr("class", "control-button") - .attr("href", "#") - .html("") - .on("click", 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); @@ -37,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 @@ -69,8 +46,6 @@ L.OSM.key = function (options) { } }); } - - return $container[0]; }; return control;