[Bookmarklet] Reselect Segments from Permalink
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.
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]
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]);}
Update: Will now reselect a venue from permalink too.
[If you've not done this before, see How to add a bookmarklet]
Re: [Bookmarklet] Reselect Segments from Permalink