From fb4816280ad9e01b31fbbe844ceb2190ca532ba0 Mon Sep 17 00:00:00 2001 From: Zeke Farwell Date: Sat, 16 Jul 2022 16:28:06 -0400 Subject: [PATCH] Fix: Open in iD button not working as expected The url format with a background parameter in the query string has stopped working. Moving the parameter to the fragment after the # and properly encoding the imagery url value resolves the issue. --- content.js | 7 ++++--- manifest.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/content.js b/content.js index 776de57..0222a2c 100644 --- a/content.js +++ b/content.js @@ -90,9 +90,10 @@ async function openModalDialog(e) */ function setModalHtmlSuccess(heatmap_url, map_color, map_type) { - let title = `Strava Heatmap (${map_color}/${map_type})` - let open_in_josm_url = `http://127.0.0.1:8111/imagery?title=${title}&type=tms&max_zoom=15&url=${heatmap_url}`; - let open_in_id_url = `https://www.openstreetmap.org/edit?editor=id&background=custom:${heatmap_url.replace(/&/g, '%26')}`; + let title = `Strava Heatmap (${map_color}/${map_type})`; + let encoded_heatmap_url = encodeURIComponent(heatmap_url); + let open_in_josm_url = `http://127.0.0.1:8111/imagery?title=${title}&type=tms&max_zoom=15&url=${encoded_heatmap_url}`; + let open_in_id_url = `https://www.openstreetmap.org/edit?editor=id#background=custom:${encoded_heatmap_url}`; let heatmap_url_tms = `tms:${heatmap_url}`; document.querySelector('#jsh-modal-header').textContent = "Open heatmap in OSM editor"; diff --git a/manifest.json b/manifest.json index 46cf3c7..7be409f 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "JOSM Strava Heatmap", "description": "A browser extension that simplifies getting the TMS imagery url for using the Strava Heatmap in JOSM", - "version": "4", + "version": "4.1", "icons": { "48": "icons/icon.png" },