From 8a8c2517f2e594bcecba1fda751ffd34b39dbe9a Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 18 Dec 2024 18:36:44 +0300 Subject: [PATCH] Add 'canEmbed' layer option --- app/assets/javascripts/leaflet.share.js | 3 ++- config/layers.yml | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index f0d2781098..7b0b5ef028 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -337,7 +337,8 @@ L.OSM.share = function (options) { } function update() { - var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo"; + const layer = map.getMapBaseLayer(); + var canEmbed = layer && layer.options.canEmbed; var bounds = map.getBounds(); $("#link_marker") diff --git a/config/layers.yml b/config/layers.yml index 4f883cc940..6a470687a2 100644 --- a/config/layers.yml +++ b/config/layers.yml @@ -2,6 +2,7 @@ code: "M" layerId: "mapnik" nameId: "standard" + canEmbed: true credit: id: "make_a_donation" href: "https://supporting.openstreetmap.org" @@ -11,6 +12,7 @@ code: "Y" layerId: "cyclosm" nameId: "cyclosm" + canEmbed: true credit: id: "cyclosm_credit" children: @@ -26,6 +28,7 @@ layerId: "cyclemap" nameId: "cycle_map" apiKeyId: "THUNDERFOREST_KEY" + canEmbed: true credit: id: "thunderforest_credit" children: @@ -38,6 +41,7 @@ layerId: "transportmap" nameId: "transport_map" apiKeyId: "THUNDERFOREST_KEY" + canEmbed: true credit: id: "thunderforest_credit" children: @@ -61,6 +65,7 @@ code: "H" layerId: "hot" nameId: "hot" + canEmbed: true credit: id: "hotosm_credit" children: