X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/71e7208a0aceccf47edce739803130096999da5d..98b1e5f76ce400af3270c3350804d40e30fd7d53:/app/assets/javascripts/leaflet.share.js?ds=sidebyside diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index c518eb4e9..73ca64f63 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -1,20 +1,12 @@ L.OSM.share = function (options) { - var control = L.OSM.sidebarPane(options), + var control = L.OSM.sidebarPane(options, "share", "javascripts.share.title", "javascripts.share.title"), marker = L.marker([0, 0], { draggable: true }), locationFilter = new L.LocationFilter({ enableButton: false, adjustButton: false }); - control.onAdd = function (map) { - var $container = $("
") - .attr("class", "control-share"); - - var button = this.makeButton("share", "javascripts.share.title", toggle) - .appendTo($container); - - var $ui = this.makeUI("share-ui", "javascripts.share.title", toggle); - + control.onAddPane = function (map, button, $ui) { // Link / Embed var $linkSection = $("
") @@ -43,26 +35,25 @@ L.OSM.share = function (options) { .bind("change", toggleMarker)) .append(I18n.t("javascripts.share.include_marker"))); - $("
") - .attr("class", "share-tabs") + $("
") .appendTo($form) - .append($("") - .attr("class", "active") + .append($("") + .addClass("active") .attr("for", "long_input") .attr("id", "long_link") .text(I18n.t("javascripts.share.long_link"))) - .append($("") + .append($("") .attr("for", "short_input") .attr("id", "short_link") .text(I18n.t("javascripts.share.short_link"))) - .append($("") + .append($("") .attr("for", "embed_html") .attr("href", "#") .text(I18n.t("javascripts.share.embed"))) .on("click", "a", function (e) { e.preventDefault(); var id = "#" + $(this).attr("for"); - $linkSection.find(".share-tabs a") + $(this).siblings("a") .removeClass("active"); $(this).addClass("active"); $linkSection.find(".share-tab") @@ -75,7 +66,6 @@ L.OSM.share = function (options) { $("
") .attr("class", "share-tab") - .css("display", "block") .appendTo($form) .append($("") .attr("id", "long_input") @@ -84,6 +74,7 @@ L.OSM.share = function (options) { $("
") .attr("class", "share-tab") + .hide() .appendTo($form) .append($("") .attr("id", "short_input") @@ -92,6 +83,7 @@ L.OSM.share = function (options) { $("
") .attr("class", "share-tab") + .hide() .appendTo($form) .append( $("