X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8a02bd67d9d20c4a6b01b58e88b8d65163a3798e..98bfaace9aeba7fb387596cc16b2e661506173c6:/app/assets/javascripts/leaflet.key.js?ds=sidebyside 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;