control.onAddPane = function (map, button, $ui) {
// Link / Embed
+ $("#content").addClass("overlay-right-sidebar");
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");
.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>")
- .attr("class", "text-muted")
+ .attr("class", "text-body-secondary")
.text(I18n.t("javascripts.share.paste_html")));
// 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>")
$("<div>")
.attr("id", "export-warning")
- .attr("class", "text-muted")
+ .attr("class", "text-body-secondary")
.text(I18n.t("javascripts.share.only_standard_layer"))
.appendTo($imageSection);
};
$("<p>")
- .attr("class", "text-muted")
+ .attr("class", "text-body-secondary")
.html(I18n.t("javascripts.share.image_dimensions", args))
.appendTo($form);
}
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)) +