Skip to content

Instantly share code, notes, and snippets.

@Fixxy
Last active April 27, 2021 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fixxy/39410b5199acd387122c38a8a9ea247e to your computer and use it in GitHub Desktop.
Save Fixxy/39410b5199acd387122c38a8a9ea247e to your computer and use it in GitHub Desktop.
function buildURL() {
const hostname = window.location.hostname;
const pathname = window.location.pathname.slice(1);
const params = new URLSearchParams(window.location.search);
const storyID = params.get('id');
return `?origin_host=${hostname}&origin_path=${encodeURIComponent(pathname)}${storyID?`&id=${storyID}`:''}`;
}
const mapFrame = document.getElementById('mapFrame');
if (typeof (mapFrame) != 'undefined' && mapFrame != null) {
mapFrame.src = `https://maps.greenpeace.org/maps/gpint/50th_guestbook/${buildURL()}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment