X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/33897d30b32b1323d8d4a3053b2a8a13cea5e5d5..dc24f6c2195c6053efd43778d53ae68984e54107:/app/assets/javascripts/leaflet.share.js diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index d43f99b1d..5fb189a76 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -1,60 +1,401 @@ -L.Control.Share = L.Control.extend({ - options: { - position: 'topright', - title: 'Share', - url: function(map) { - return ''; - } - }, +L.OSM.share = function (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 + }); - onAdd: function (map) { - var className = 'control-share', - container = L.DomUtil.create('div', className); + control.onAddPane = function (map, button, $ui) { + // Link / Embed - var link = L.DomUtil.create('a', 'control-button', container); - link.innerHTML = ""; - link.href = '#'; - link.title = this.options.title; + var $linkSection = $("
") + .attr("class", "section share-link") + .appendTo($ui); - this._uiPane = this.options.uiPane; + $("

") + .text(I18n.t("javascripts.share.link")) + .appendTo($linkSection); - this._map = map; + var $form = $("
") + .appendTo($linkSection); - var h2 = L.DomUtil.create('h2', '', this._uiPane); - h2.innerHTML = I18n.t('javascripts.share.title'); + $("
") + .attr("class", "form-check mb-3") + .appendTo($form) + .append($("