.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");
.attr("id", "long_input")
.attr("type", "text")
.attr("class", "form-control form-control-sm font-monospace")
+ .attr("readonly", true)
.on("click", select));
$("<div>")
.attr("id", "short_input")
.attr("type", "text")
.attr("class", "form-control form-control-sm font-monospace")
+ .attr("readonly", true)
.on("click", select));
$("<div>")
$("<textarea>")
.attr("id", "embed_html")
.attr("class", "form-control form-control-sm font-monospace")
+ .attr("readonly", true)
.on("click", select))
.append(
$("<p>")
}
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)) +