Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Post Reply
Forum rules
Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

DO NOT START a new thread unless it is about a new idea. Keep discussion of existing tools within the main thread for that tool.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

[Bookmarklet] Reselect Segments from Permalink

Post by Timbones
Ever looked at a permalink, and realised it needed zooming or panning to get all the required segments selected? Or accidentally clicked on the map and lost the selection? Well, this bookmarklet is for you! Quite simply, it gets the list of segments IDs from the URL, and selects them again in WME.

Code: Select all

javascript:if(q=location.search.match(new RegExp("[?&]segments?=([^&]*)"))){s=q[1].split(',');o=[];for(i=0;i<s.length;i++){n=W.model.segments.objects[s[i]];if(typeof n!='undefined')o.push(n);}W.selectionManager.setSelectedModels(o);}else if(q=location.search.match(new RegExp("[?&]venues?=([^&]*)"))){n=W.model.venues.objects[q[1]];if(typeof n!='undefined')W.selectionManager.setSelectedModels([n]);}
Caveats: This is not guaranteed to select all the segments if any haven't been loaded by WME, and there's little error checking so it may fail to work in some situations. Tested in Chrome and Firefox.

Update: Will now reselect a venue from permalink too.

[If you've not done this before, see How to add a bookmarklet]
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times

POSTER_ID:1445148

1

Send a message
Last edited by Timbones on Thu Apr 26, 2018 10:37 am, edited 4 times in total.
Reason: Updated - April 2018
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries

Post by herrchin
Timbones, you haven't by chance crafted the equivalent bookmarklet for PLs to Places have you? I seem to have WME loading issues recently where the Place doesn't always like to select consistently.
herrchin
Country Manager
Country Manager
Posts: 333
Has thanked: 199 times
Been thanked: 161 times
Send a message

Post by herrchin
Timbones wrote:Nice work, Iain! As you suggest, the loop could be omitted for venues: (untested)
Tested and working! Thanks to you both!
herrchin
Country Manager
Country Manager
Posts: 333
Has thanked: 199 times
Been thanked: 161 times
Send a message

Post by iainhouse
herrchin wrote:Timbones, you haven't by chance crafted the equivalent bookmarklet for PLs to Places have you?
Just for the fun of it, I tried this:

Code: Select all

javascript:if(q=window.location.search.match(new RegExp("[?&]venues?=([^&]*)"))){s=q[1].split(',');o=[];for(i=0;i<s.length;i++){n=Waze.model.venues.objects[s[i]];if(typeof n!='undefined')o.push(n);}Waze.selectionManager.select(o);}
It's probably a bit "wasteful" in terms of code, because you can have multiple segments to reselect, but can only select one place at a time. But it seems to work :mrgreen:
iainhouse
EmeritusChamps
EmeritusChamps
Posts: 11143
Answers: 1
Has thanked: 2173 times
Been thanked: 8188 times
Send a message
https://storage.googleapis.com/wazeoped ... c4/AGC.pnghttps://sign.waze.tools/s2000.pnghttps://sign.waze.tools/c6.png
My scripts: WME FixUI WME Presets :ugeek:
I want to go to a commune in Vermont and deal with no unit of time shorter than a season

Post by itzwolf
Timbones wrote:Updated to work on new WME with changes Waze made to the W.selectionManager.
Also merged in Iain's Venue reselect, so you only need 1 bookmarklet to do both!

:ugeek:
Thank you for the updated bookmarklet, I use these every single day. :D
itzwolf
Waze Global Champs
Waze Global Champs
Posts: 1216
Has thanked: 872 times
Been thanked: 110 times
Send a message

Post by Timbones
iainhouse wrote:It's probably a bit "wasteful" in terms of code, because you can have multiple segments to reselect, but can only select one place at a time. But it seems to work :mrgreen:
Nice work, Iain! As you suggest, the loop could be omitted for venues: (untested)

Code: Select all

javascript:if(q=window.location.search.match(new RegExp("[?&]venues?=([^&]*)"))){o=[];n=Waze.model.venues.objects[q[1]];if(typeof n!='undefined')o.push(n);Waze.selectionManager.select(o);}
I'll see about merging this with the segments one at some point...
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times
Send a message
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries

Post by Timbones
Updated to work on new WME with changes Waze made to the W.selectionManager.
Also merged in Iain's Venue reselect, so you only need 1 bookmarklet to do both!

:ugeek:
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times
Send a message
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries