Allows external webpages to load permalinks directly into an existing instance of Waze Map Editor, without reloading it.
This works by having two parts:
- a piece of Javascript on the external webpage that attempts to locate the WME tab, and sent the permalink via a message
- this userscript that runs in WME that listens for permalink messages, and loads them into the current session
- WME links from one page will all open into specifc tab, except for Beta links which will go to a separate tab
- All permalink parameters are supported, using native 'restore' functions in WME, including selecting segments and opening URs
- This works even after reloading the external page, or visiting another page, as long as it's in the same browser tab/window
- If userscript is not installed, or does not work for another reason, then it will fallback to doing a full load of the permalink
Load 'permalink-loader.js' into the <head>
of the HTML document, and then do either A or B below:
A: add the following onclick attribute to each of your tags:
<a href="..." onclick="return loadPermalink(this)">click here</a>
or, if you're building DOM elements in Javascript:
a.onclick = function() { return loadPermalink(a); };
for other kinds of element, you can pass the permalink as a string to the loadPermalink()
function.
B: or, add the following code at the top of document to upgrade all the permalinks:
<body onload="upgradePermalinks()">
There are other ways to trigger upgradePermalinks()
if you prefer.