X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/1220a9930e7e3d9662a9a7ba49d320fdbe1a1021..5dc9fb3dc550a7b81ee6df5d6ca97e050798aba9:/app/assets/javascripts/leaflet.share.js diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index c096a92fc..eb351fa02 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -46,10 +46,13 @@ L.OSM.share = function (options) { .text(I18n.t("javascripts.share.short_link"))) .append($("") .attr("for", "embed_html") + .attr("id", "embed_link") + .attr("data-bs-title", I18n.t("javascripts.site.embed_html_disabled")) .attr("href", "#") .text(I18n.t("javascripts.share.embed"))) .on("click", "a", function (e) { e.preventDefault(); + if (!$(this).hasClass("btn-primary")) return; var id = "#" + $(this).attr("for"); $(this).siblings("a") .removeClass("active"); @@ -309,6 +312,7 @@ L.OSM.share = function (options) { } function update() { + var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo"; var bounds = map.getBounds(); $("#link_marker") @@ -334,6 +338,14 @@ L.OSM.share = function (options) { params.marker = latLng.lat + "," + latLng.lng; } + $("#embed_link") + .toggleClass("btn-primary", canEmbed) + .toggleClass("btn-secondary", !canEmbed) + .tooltip(canEmbed ? "disable" : "enable"); + if (!canEmbed && $("#embed_link").hasClass("active")) { + $("#long_link").click(); + } + $("#embed_html").val( "