Skip to content

Commit

Permalink
Fix: Open in iD button not working as expected
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zekefarwell committed Jul 16, 2022
1 parent 4cdea62 commit fb48162
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit fb48162

Please sign in to comment.