// Link / Embed
var $linkSection = $("<div>")
- .attr("class", "section share-link")
+ .attr("class", "share-link p-3 border-bottom border-secondary-subtle")
.appendTo($ui);
$("<h4>")
.text(I18n.t("javascripts.share.short_link")))
.append($("<a class='btn btn-primary'>")
.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");
// Geo URI
var $geoUriSection = $("<div>")
- .attr("class", "section share-geo-uri")
+ .attr("class", "share-geo-uri p-3 border-bottom border-secondary-subtle")
.appendTo($ui);
$("<h4>")
// Image
var $imageSection = $("<div>")
- .attr("class", "section share-image")
+ .attr("class", "share-image p-3")
.appendTo($ui);
$("<h4>")
}
function update() {
+ var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo";
var bounds = map.getBounds();
$("#link_marker")
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(
"<iframe width=\"425\" height=\"350\" src=\"" +
escapeHTML(OSM.SERVER_PROTOCOL + "://" + OSM.SERVER_URL + "/export/embed.html?" + $.param(params)) +