X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/01eed9b96c47365c1e6517df6d21f5d8b9286f29..08385495986180ccd6855bee8d889af205922950:/app/assets/javascripts/leaflet.share.js diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index c096a92fc..0b868d2ca 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -10,7 +10,7 @@ L.OSM.share = function (options) { // Link / Embed var $linkSection = $("
") - .attr("class", "section share-link") + .attr("class", "share-link p-3 border-bottom border-secondary-subtle") .appendTo($ui); $("

") @@ -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"); @@ -95,13 +98,13 @@ L.OSM.share = function (options) { .on("click", select)) .append( $("

") - .attr("class", "text-muted") + .attr("class", "text-body-secondary") .text(I18n.t("javascripts.share.paste_html"))); // Geo URI var $geoUriSection = $("

") - .attr("class", "section share-geo-uri") + .attr("class", "share-geo-uri p-3 border-bottom border-secondary-subtle") .appendTo($ui); $("

") @@ -116,7 +119,7 @@ L.OSM.share = function (options) { // Image var $imageSection = $("
") - .attr("class", "section share-image") + .attr("class", "share-image p-3") .appendTo($ui); $("

") @@ -125,7 +128,7 @@ L.OSM.share = function (options) { $("
") .attr("id", "export-warning") - .attr("class", "text-muted") + .attr("class", "text-body-secondary") .text(I18n.t("javascripts.share.only_standard_layer")) .appendTo($imageSection); @@ -220,7 +223,7 @@ L.OSM.share = function (options) { }; $("

") - .attr("class", "text-muted") + .attr("class", "text-body-secondary") .html(I18n.t("javascripts.share.image_dimensions", args)) .appendTo($form); @@ -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( "