Merge remote-tracking branch 'upstream/pull/4367'

This commit is contained in:
Tom Hughes 2023-11-26 18:57:16 +00:00
commit 8c8aa10428
2 changed files with 13 additions and 0 deletions

View file

@ -46,10 +46,13 @@ L.OSM.share = function (options) {
.text(I18n.t("javascripts.share.short_link"))) .text(I18n.t("javascripts.share.short_link")))
.append($("<a class='btn btn-primary'>") .append($("<a class='btn btn-primary'>")
.attr("for", "embed_html") .attr("for", "embed_html")
.attr("id", "embed_link")
.attr("data-bs-title", I18n.t("javascripts.site.embed_html_disabled"))
.attr("href", "#") .attr("href", "#")
.text(I18n.t("javascripts.share.embed"))) .text(I18n.t("javascripts.share.embed")))
.on("click", "a", function (e) { .on("click", "a", function (e) {
e.preventDefault(); e.preventDefault();
if (!$(this).hasClass("btn-primary")) return;
var id = "#" + $(this).attr("for"); var id = "#" + $(this).attr("for");
$(this).siblings("a") $(this).siblings("a")
.removeClass("active"); .removeClass("active");
@ -309,6 +312,7 @@ L.OSM.share = function (options) {
} }
function update() { function update() {
var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo";
var bounds = map.getBounds(); var bounds = map.getBounds();
$("#link_marker") $("#link_marker")
@ -334,6 +338,14 @@ L.OSM.share = function (options) {
params.marker = latLng.lat + "," + latLng.lng; 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( $("#embed_html").val(
"<iframe width=\"425\" height=\"350\" src=\"" + "<iframe width=\"425\" height=\"350\" src=\"" +
escapeHTML(OSM.SERVER_PROTOCOL + "://" + OSM.SERVER_URL + "/export/embed.html?" + $.param(params)) + escapeHTML(OSM.SERVER_PROTOCOL + "://" + OSM.SERVER_URL + "/export/embed.html?" + $.param(params)) +

View file

@ -3034,6 +3034,7 @@ en:
map_data_zoom_in_tooltip: Zoom in to see map data map_data_zoom_in_tooltip: Zoom in to see map data
queryfeature_tooltip: Query features queryfeature_tooltip: Query features
queryfeature_disabled_tooltip: Zoom in to query features queryfeature_disabled_tooltip: Zoom in to query features
embed_html_disabled: HTML embedding is not available for this map layer
changesets: changesets:
show: show:
comment: "Comment" comment: "Comment"