Bookmarklets: Difference between revisions View history

m (→‎Open Waze Map Editor from LiveMap: Removed duplicate "click.")
 
(31 intermediate revisions by 11 users not shown)
Line 1: Line 1:
<!--if the section parameter is defined, do not place the visible banner, only as the code block for the top of a section-->{{GlobalMark/visible}}
<!--
#####-----#####-----#####-----#####-----#####-----#####-----#####-----#####-----
####    This page has been curated  ####
####    to be included in the new    ####
####    Wazeopedia - GLOBAL Wiki.  ####
####    Please do not make any      ####
####    edits on this page without  ####
####    PRIOR CONSENSUS in the Wiki  ####
####    Updates and Discussions      ####
####    forum thread for this page.  ####
####    If a specific forum thread  ####
####    for this page doesn't exist  ####
####    please start one.            ####
####        www.waze.com/forum/      ####
####        viewforum.php?f=276      ####
#####-----#####-----#####-----#####-----#####-----#####-----#####-----#####-->
{{construction
| contact    = http://www.waze.com/forum/viewtopic.php?f=276&t=94974
| contacttype = forum
| draft      = yes
| open        = yes}}
A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands to extend the browser's functionality through a single mouse click. For instance, a bookmarklet might enable the user to select an editor username on a page, click the bookmarklet, and be taken directly to the private message page with the username already entered.
A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands to extend the browser's functionality through a single mouse click. For instance, a bookmarklet might enable the user to select an editor username on a page, click the bookmarklet, and be taken directly to the private message page with the username already entered.


== Adding to a browser ==
==Adding to a browser==


=== Chrome ===
===Chrome===
To add a bookmarklet to Google Chrome, you must open the Bookmark Manager. There are three methods to do this:
To add a bookmarklet to Google Chrome, you must open the Bookmark Manager. There are three methods to do this:


Line 33: Line 9:


[[File:Chrome bookmark manager menu.png|right|400px|Click image to enlarge]]
[[File:Chrome bookmark manager menu.png|right|400px|Click image to enlarge]]
* Left click on the Chrome menu [[File:Chrome-menu-button.png]] on the browser toolbar.


* Hoover over the "Bookmarks" menu and a drop-down menu will display
*Left click on the Chrome menu [[File:Chrome-menu-button.png]] on the browser toolbar.
 
*Hover over the "Bookmarks" menu and a drop-down menu will display


* Left click on "Bookmark Manager"
*Left click on "Bookmark Manager"
{{clear}}
{{clear}}


Line 43: Line 20:


[[File:Bookmark Bar menu.png|right|border]]
[[File:Bookmark Bar menu.png|right|border]]
* If you have the Bookmark Bar enabled, right-click anywhere on the Bookmark Bar


* Scroll down to Bookmark Manager and left-click
*If you have the Bookmark Bar enabled, right-click anywhere on the Bookmark Bar
 
*Scroll down to Bookmark Manager and left-click
{{clear}}
{{clear}}


Line 51: Line 29:


[[File:Bookmark Manager.png|right|border]]  
[[File:Bookmark Manager.png|right|border]]  
* Just use the shortcut {{key press|Ctrl|Shift|O}} or {{key press|Cmd|Option|B}}
 
*Just use the shortcut {{key press|Ctrl|Shift|O}} or {{key press|Cmd|Option|B}}


After Opening the Bookmark menu:
After Opening the Bookmark menu:


* In the left window pane, navigate to where you want to add the bookmarklet.
*In the left window pane, navigate to where you want to add the bookmarklet.
{{clear}}
{{clear}}


[[File:Bookmark Manager dropdown menu.png|right|border]]
[[File:Bookmark Manager dropdown menu.png|right|border]]
* In the main window pane, right click to see the context menu.


* Left click on "Add page"
*In the main window pane, right click to see the context menu.
 
*Left click on "Add page"
{{clear}}
{{clear}}


[[File:Bookmark Manager add page.png|right|border]]
[[File:Bookmark Manager add page.png|right|border]]
* In the "Name" box, enter any name you prefer to assist in identifying the bookmarklet. You could also leave it empty.


* In the "URL" box, paste the code your previously copied.
*In the "Name" box, enter any name you prefer to assist in identifying the bookmarklet. You could also leave it empty.
 
*In the "URL" box, paste the code your previously copied.


When finished, it should look something like this:
When finished, it should look something like this:
Line 76: Line 57:
Shortcut keys can be added with external add-on tools. One example is [http://www.howtogeek.com/127162/how-to-create-custom-keyboard-shortcuts-for-browser-actions-and-extensions-in-google-chrome/ this tool].
Shortcut keys can be added with external add-on tools. One example is [http://www.howtogeek.com/127162/how-to-create-custom-keyboard-shortcuts-for-browser-actions-and-extensions-in-google-chrome/ this tool].


=== Firefox ===
===Firefox===
* Ensure the Bookmarks toolbar is visible with a Right-click in a blank area of the Firefox tab row or menu bar area. Alternately you can open the Bookmarks window with Ctrl-B.
 
*Ensure the Bookmarks toolbar is visible with a Right-click in a blank area of the Firefox tab row or menu bar area. Alternately you can open the Bookmarks window with Ctrl-B.
 
*Right-click the bookmark bar or window and select '''New Bookmark.'''
 
*Enter a name for the bookmarklet in the '''Name''' field.
 
*The '''Location''' field is where you copy and paste the javascript code from one of the code boxes below. Be sure to include everything from the code box.
 
*The other fields are not required. Press '''Add''' to save the changes.
 
*Repeat the process for each bookmarklet desired.
 
==Running Bookmarkets==
'''Desktops:'''


* Right-click the bookmark bar or window and select '''New Bookmark.'''
Bookmarklets are easiest to use if you have your browser’s bookmarks toolbar enabled. Just click the bookmarklet and your browser will run it on the current page.


* Enter a name for the bookmarklet in the '''Name''' field.
'''Mobile Safari:'''


* The '''Location''' field is where you copy and paste the javascript code from one of the code boxes below. Be sure to include everything from the code box.
If you don’t have a bookmarks toolbar — such as on Safari on an iPad or another mobile browser — just open your browser’s bookmarks pane and tap or click the bookmark.


* The other fields are not required. Press '''Add''' to save the changes.
'''Mobile Chrome:'''


* Repeat the process for each bookmarklet desired.
#Pick a good name for it that you can get to auto-complete quickly.
#Type the name into the search bar when you want to run it.
#Tap the bookmarklet when it shows up in the drop-down.


== Defined scripts ==
==Defined scripts==
The following bookmarklet scripts could be helpful to map editors. Following the instructions above for adding a bookmarklet based on your browser, select the code below with your mouse, highlighting all the code inside the box. Use that code to paste into the bookmark as the target or location.
The following bookmarklet scripts could be helpful to map editors. Following the instructions above for adding a bookmarklet based on your browser, select the code below with your mouse, highlighting all the code inside the box. Use that code to paste into the bookmark as the target or location.


Line 95: Line 92:


<!-- this link has a script that needs to be added. http://www.waze.com/forum/viewtopic.php?f=12&t=17684#p431249 -->
<!-- this link has a script that needs to be added. http://www.waze.com/forum/viewtopic.php?f=12&t=17684#p431249 -->
=== Map location ===
===Map location===


==== Open Waze Map Editor from LiveMap ====
====Open Waze Map Editor from LiveMap====
A script is no longer necessary. Click click the "Edit the map" link when viewing Livemap.
A script is no longer necessary. Click the "Edit the map" link when viewing Livemap.


==== Open LiveMap from Waze Map Editor ====
====Open LiveMap from Waze Map Editor====
This script opens a window with [[Live Map]] when currently viewing Waze Map Editor.
This script opens a window with [[Live Map]] when currently viewing Waze Map Editor.


Line 109: Line 106:


''A drag-n-drop link can be copied from [http://dl.dropbox.com/u/1437031/waze_bookmarklets.html this dropbox page] (AlanOfTheBerg's dropbox).''
''A drag-n-drop link can be copied from [http://dl.dropbox.com/u/1437031/waze_bookmarklets.html this dropbox page] (AlanOfTheBerg's dropbox).''
=== Map editing ===
===Map editing===
{{Throttle warn}}
{{Throttle warn}}
==== Custom location scripts ====
====Custom location scripts====
If you know of a script for a specific area, please add it to this list or request help from [http://www.waze.com/forum/viewforum.php?f=276 this forum] for it to be added.
If you know of a script for a specific area, please add it to this list or request help from [http://www.waze.com/forum/viewforum.php?f=276 this forum] for it to be added.


* [[Michigan mapping resources|Michigan]]
*[[New York/Resources|New York]]
* [[New York/Resources|New York]]
 
====Enable Pinch-to-Zoom Navigation====
For mobile devices and tablets, this will enable two-fingered pinch zoom.
 
{{pre2|<nowiki>
javascript:(function(){ol=function(n){var s=document.createElement('script');s.setAttribute('src','https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/lib/OpenLayers/'+n+'.js');document.body.appendChild(s);};ol('Control/PinchZoom');ol('Handler/Pinch');ol('Control/TouchNavigation');window.setTimeout(function(){Waze.map.addControl(new OpenLayers.Control.TouchNavigation);}, 100)}());
</nowiki>}}
<!-- contributed by Timbones -->
 
====Reselect Segments from Permalink====
This simply gets the list of segments IDs from the URL, and selects them again in WME.
 
{{pre2|<nowiki>
javascript:if(q=window.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);}
</nowiki>}}
<!-- contributed by Timbones -->


==== Set segment locks in area ====
====Set segment locks in area====
This script will set the lock rank on various segment types in the visible area of the WME. Current configuration listed:
This script will set the [[Lock level|lock rank]] on various segment types in the visible area of the WME. Note that the script uses levels one lower than the level will be applied, e.g., if the script says "fwy_lvl=4" then the Freeway will be locked at 5. Current configuration as listed in this script:


* It will only update up to 150 segments
*It will only update up to 150 segments
* It only modifies what can be modified by the user's current rank and area
*It only modifies what can be modified by the [[Editing rank|user's current rank]] and area
**If the user's current rank is lower than the defined lock level, it will lock the roads at the user's rank
**If the user's current rank is lower than the defined lock level, it will lock the roads at the user's rank
* It will not lower a rank less than it is currently set
*It will not lower a rank less than it is currently set
* Freeways and Ramps are set to 4
*Freeways are set to 5
* Major Highways are set to 3
*Ramps are set to 4
* Minor Highways are set to 2
*Major Highways are set to 4
* Primary Streets are set to 2
*Minor Highways are set to 3
* Railroads are set to 2
*Primary Streets are set to 2
* Ferries are set to 5
*Private Roads are set to 2
*Railroads are set to 2
*Ferries are set to 5


<!-- Do not modify this code directly. Go to the talk page to modify the formatted code and then compress it and paste the result below -->
<!-- Do not modify this code directly. Go to the talk page to modify the formatted code and then compress it and paste the result below -->
{{pre2|<nowiki>
{{pre2|<nowiki>
javascript:(function(){var fwy_lvl=4;var rmp_lvl=3;var maj_lvl=2;var min_lvl=1;var pri_lvl=1;var rr_lvl=1;var fer_lvl=4;var absolute=false;var count=0;var thisUser=Waze.loginManager.user;if(thisUser===null)return;var usrRank=thisUser.normalizedLevel;var UpdateObject;if(typeof(require)!=="undefined"){UpdateObject=require("Waze/Action/UpdateObject")}else{UpdateObject=Waze.Action.UpdateObject}if(fwy_lvl>(usrRank-1))fwy_lvl=usrRank-1;if(rmp_lvl>(usrRank-1))rmp_lvl=usrRank-1;if(maj_lvl>(usrRank-1))maj_lvl=usrRank-1;if(min_lvl>(usrRank-1))min_lvl=usrRank-1;if(pri_lvl>(usrRank-1))pri_lvl=usrRank-1;function onScreen(obj){if(obj.geometry){return(W.map.getExtent().intersectsBounds(obj.geometry.getBounds()))}return(false)}Object.forEach(W.model.segments.objects,function(k,v){if(count<150&&onScreen(v)&&v.isGeometryEditable()){if(v.attributes.roadType==3&&(v.attributes.lockRank<fwy_lvl||(absolute&&v.attributes.lockRank!=fwy_lvl))){count++;W.model.actionManager.add(new UpdateObject(v,{lockRank:fwy_lvl}))}if(v.attributes.roadType==4&&(v.attributes.lockRank<rmp_lvl||(absolute&&v.attributes.lockRank!=rmp_lvl))){count++;W.model.actionManager.add(new UpdateObject(v,{lockRank:rmp_lvl}))}if(v.attributes.roadType==6&&(v.attributes.lockRank<maj_lvl||(absolute&&v.attributes.lockRank!=maj_lvl))){count++;W.model.actionManager.add(new UpdateObject(v,{lockRank:maj_lvl}))}if(v.attributes.roadType==7&&(v.attributes.lockRank<min_lvl||(absolute&&v.attributes.lockRank!=min_lvl))){count++;W.model.actionManager.add(new UpdateObject(v,{lockRank:min_lvl}))}if(v.attributes.roadType==2&&(v.attributes.lockRank<pri_lvl||(absolute&&v.attributes.lockRank!=pri_lvl))){count++;W.model.actionManager.add(new UpdateObject(v,{lockRank:pri_lvl}))}if(v.attributes.roadType==18&&(v.attributes.lockRank<rr_lvl||(absolute&&v.attributes.lockRank!=rr_lvl))){count++;W.model.actionManager.add(new UpdateObject(v,{lockRank:rr_lvl}))}if(v.attributes.roadType==14&&(v.attributes.lockRank<fer_lvl||(absolute&&v.attributes.lockRank!=fer_lvl))){count++;W.model.actionManager.add(new UpdateObject(v,{lockRank:fer_lvl}))}}})})();
javascript: (function() { var fwy_lvl = 4; var rmp_lvl = 3; var maj_lvl = 3; var min_lvl = 2; var pri_lvl = 1; var prv_lvl = 1; var rr_lvl = 1; var fer_lvl = 4; var absolute = false; var count = 0; var thisUser = W.loginManager.user; if (thisUser === null) return; var usrRank = thisUser.normalizedLevel; var UpdateObject; if (typeof(require) !== "undefined") { UpdateObject = require("Waze/Action/UpdateObject"); } else { UpdateObject = W.Action.UpdateObject; } if (fwy_lvl > (usrRank - 1)) fwy_lvl = usrRank - 1; if (rmp_lvl > (usrRank - 1)) rmp_lvl = usrRank - 1; if (maj_lvl > (usrRank - 1)) maj_lvl = usrRank - 1; if (min_lvl > (usrRank - 1)) min_lvl = usrRank - 1; if (pri_lvl > (usrRank - 1)) pri_lvl = usrRank - 1; function onScreen(obj) { if (obj.geometry) { return (W.map.getExtent().intersectsBounds(obj.geometry.getBounds())); } return (false); } W.model.segments.getObjectArray().forEach(function(v) { if (count < 150 && onScreen(v) && v.isGeometryEditable()) { if (v.attributes.roadType == 3 && (v.attributes.lockRank < fwy_lvl || (absolute && v.attributes.lockRank != fwy_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: fwy_lvl })); } if (v.attributes.roadType == 4 && (v.attributes.lockRank < rmp_lvl || (absolute && v.attributes.lockRank != rmp_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: rmp_lvl })); } if (v.attributes.roadType == 6 && (v.attributes.lockRank < maj_lvl || (absolute && v.attributes.lockRank != maj_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: maj_lvl })); } if (v.attributes.roadType == 7 && (v.attributes.lockRank < min_lvl || (absolute && v.attributes.lockRank != min_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: min_lvl })); } if (v.attributes.roadType == 2 && (v.attributes.lockRank < pri_lvl || (absolute && v.attributes.lockRank != pri_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: pri_lvl })); } if (v.attributes.roadType == 17 && (v.attributes.lockRank < prv_lvl || (absolute && v.attributes.lockRank != prv_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: prv_lvl })); } if (v.attributes.roadType == 18 && (v.attributes.lockRank < rr_lvl || (absolute && v.attributes.lockRank != rr_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: rr_lvl })); } if (v.attributes.roadType == 15 && (v.attributes.lockRank < fer_lvl || (absolute && v.attributes.lockRank != fer_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: fer_lvl })); } } }); })();
</nowiki>}}
</nowiki>}}


==== Extraneous node remover ====
====Extraneous node remover====
This script will remove extraneous junction nodes that are not required. It will not remove nodes that prevent the problems related to loops with too few segments. This function is similar to the feature built into the Toolbox, but it operates as a stand alone script from other tools.
This script will remove extraneous junction nodes that are not required. It will not remove nodes that prevent the problems related to loops with too few segments. This function is similar to the feature built into the Toolbox, but it operates as a stand alone script from other tools.


<!-- Do not modify this code directly. Go to the talk page to modify the formatted code and then compress it and paste the result below -->
<!-- Do not modify this code directly. Go to the talk page to modify the formatted code and then compress it and paste the result below -->
{{pre2|<nowiki>
{{pre2|<nowiki>
javascript: (function() { var count = 0; var geo = W.map.getExtent().toGeometry(); _.each(W.model.nodes.objects, function(v, k) { if (count < 10) { if (v.areConnectionsEditable() && geo.containsPoint(v.geometry) && v.state != "Delete") { console.log(v); if (v.attributes.segIDs.length == 2) { var seg1 = W.model.segments.getObjectById(v.attributes.segIDs[0]); var seg2 = W.model.segments.getObjectById(v.attributes.segIDs[1]); if (seg1 && seg2 && seg1.attributes.primaryStreetID == seg2.attributes.primaryStreetID && seg1.attributes.roadType == seg2.attributes.roadType && seg1.isOneWay() == seg2.isOneWay() && seg1.isDrivable() && seg2.isDrivable() && !seg1.attributes.hasClosures && !seg2.attributes.hasClosures && seg1.attributes.junctionID == null && seg2.attributes.junctionID == null && seg1.attributes.level == seg2.attributes.level && seg1.attributes.flags == seg2.attributes.flags && seg1.attributes.fwdToll == seg2.attributes.fwdToll && seg1.attributes.lockRank == seg2.attributes.lockRank && seg1.attributes.rank == seg2.attributes.rank) { var update = true; if (seg1.attributes.toNodeID == seg1.attributes.fromNodeID || seg2.attributes.toNodeID == seg2.attributes.fromNodeID) { update = false; } if (seg1.attributes.toNodeID != v.attributes.id && (seg1.attributes.toNodeID == seg2.attributes.toNodeID || seg1.attributes.toNodeID == seg2.attributes.fromNodeID)) { update = false; } if (seg1.attributes.fromNodeID != v.attributes.id && (seg1.attributes.fromNodeID == seg2.attributes.toNodeID || seg1.attributes.fromNodeID == seg2.attributes.fromNodeID)) { update = false; } if (update) { var n1, n2; if (seg1.attributes.toNodeID == v.attributes.id) n1 = W.model.nodes.getObjectById(seg1.attributes.fromNodeID); else n1 = W.model.nodes.getObjectById(seg1.attributes.toNodeID); if (seg2.attributes.toNodeID == v.attributes.id) n2 = W.model.nodes.getObjectById(seg2.attributes.fromNodeID); else n2 = W.model.nodes.getObjectById(seg2.attributes.toNodeID); for (var i = 0; i < n1.attributes.segIDs.length; i++) { for (var j = 0; j < n2.attributes.segIDs.length; j++) { if (n1.attributes.segIDs[i] == n2.attributes.segIDs[j]) { console.log("Merge on", v.attributes.id, "would cause two or more segments connected to same nodes."); update = false; } if (update == false) break; } if (update == false) break; } } if (update) { var MergeSegments = require('Waze/Action/MergeSegments'); W.model.actionManager.add(new MergeSegments(seg1, seg2, v)); count++; console.log("merged(" + count + ") " + seg1.id + " with " + seg2.id + " at " + v.attributes.id); } } } } } }); })();</nowiki>}}
====Geometry Node Wiper (GeoWipe)====
Completely straightens all selected segments by removing all geometry nodes. DO NOT USE this on segments which are supposed to curve or have doglegs on them for navigational aids.
{{pre2|<nowiki>
javascript:(function() {var UpdateSegmentGeometry=require("Waze/Action/UpdateSegmentGeometry");  _.each(Waze.selectionManager.selectedItems, function(k, va) {v=va.model;if (v && v.type == "segment" && v.geometry.components.length > 2) {var geo = v.geometry.clone();        geo.components.splice(1,geo.components.length-2);geo.components[0].calculateBounds();        geo.components[1].calculateBounds();Waze.model.actionManager.add(new UpdateSegmentGeometry(v, v.geometry, geo));}});})();</nowiki>}}


javascript:(function(){var count=0;var geo=W.map.getExtent().toGeometry();Object.forEach(W.model.nodes.objects,function(k,v){if(count<10){if(v.areConnectionsEditable()&&geo.containsPoint(v.geometry)){if(v.attributes.segIDs.length==2){var seg1=W.model.segments.get(v.attributes.segIDs[0]);var seg2=W.model.segments.get(v.attributes.segIDs[1]);if(seg1&&seg2&&seg1.attributes.primaryStreetID==seg2.attributes.primaryStreetID&&seg1.attributes.roadType==seg2.attributes.roadType&&seg1.isOneWay()==seg2.isOneWay()&&seg1.isDrivable()&&seg2.isDrivable()){var update=true;if(seg1.attributes.fwdRestrictions&&seg1.attributes.revRestrictions&&seg2.attributes.fwdRestrictions&&seg2.attributes.revRestrictions&&v.attributes.restrictions){if(seg1.attributes.fwdRestrictions.length==0&&seg1.attributes.revRestrictions.length==0&&seg2.attributes.fwdRestrictions.length==0&&seg2.attributes.revRestrictions.length==0){for(var obj in v.attributes.restrictions){update=false;break}if(seg1.attributes.toNodeID==seg1.attributes.fromNodeID||seg2.attributes.toNodeID==seg2.attributes.fromNodeID){update=false}if(seg1.attributes.toNodeID!=v.fid&&(seg1.attributes.toNodeID==seg2.attributes.toNodeID||seg1.attributes.toNodeID==seg2.attributes.fromNodeID)){update=false}if(seg1.attributes.fromNodeID!=v.fid&&(seg1.attributes.fromNodeID==seg2.attributes.toNodeID||seg1.attributes.fromNodeID==seg2.attributes.fromNodeID)){update=false}if(update){var n1;var n2;if(seg1.attributes.toNodeID==v.fid){n1=W.model.nodes.get(seg1.attributes.fromNodeID)}else{n1=W.model.nodes.get(seg1.attributes.toNodeID)}if(seg2.attributes.toNodeID==v.fid){n2=W.model.nodes.get(seg2.attributes.fromNodeID)}else{n2=W.model.nodes.get(seg2.attributes.toNodeID)}for(var i=0;i<n1.attributes.segIDs.length;i++){for(var j=0;j<n2.attributes.segIDs.length;j++){if(n1.attributes.segIDs[i]==n2.attributes.segIDs[j]){console.log("Merge on",v.fid,"would cause two or more segments connected to same nodes.");update=false}if(update==false){break}}if(update==false){break}}}if(update){W.model.actionManager.add(new W.Action.MergeSegments(null,v));count++;console.log("merged("+count+") "+seg1.fid+" with "+seg2.fid+" at "+v.fid)}}}}}}}})})();</nowiki>}}
====Segment Length====
Displays the selected segment's length (similar to the Toolbox Measure tool) in both imperial and metric values, rounded to 2 decimals. This is intended for editors that are not able to use scripts on their PC, therefore can only see the segment length in whole meters (which when viewing in imperial is therefore rounded incorrectly) in the left panel of WME.
{{pre2|<nowiki>
javascript: (function() { var length = 0; if(W.selectionManager.getSelectedFeatures().length === 1){ var segment = W.selectionManager.getSelectedFeatures()[0]; var line = new OL.Geometry.LineString(segment.geometry.components); length = line.getGeodesicLength(W.map.getProjectionObject()); alert(Math.round((length * 100))/100 + "m" + "\n" + Math.round((length * 3.28084 * 100))/100 + "ft");}})();</nowiki>}}


==== Geometry Node Wiper (GeoWipe) ====
====Clear House Numbers====
Completely straightens all selected segments by removing all geometry nodes. DO NOT USE this on segments which are supposed to curve or have doglegs on them for navigational aids.
Clears all house numbers from a segment. Must be in the House Number editor when this bookmarklet is run.
{{pre2|<nowiki>
{{pre2|<nowiki>
javascript:(function() {var UpdateSegmentGeometry=require("Waze/Action/UpdateSegmentGeometry");   Object.forEach(Waze.selectionManager.selectedItems, function(k, va) {v=va.model;if (v && v.type == "segment" && v.geometry.components.length > 2) {var geo = v.geometry.clone();        geo.components.splice(1,geo.components.length-2);geo.components[0].calculateBounds();        geo.components[1].calculateBounds();Waze.model.actionManager.add(new UpdateSegmentGeometry(v, v.geometry, geo));}});})();</nowiki>}}
javascript: (function() {
    let DeleteHouseNumber = require('Waze/Actions/DeleteHouseNumber');
    let currMarker;
    let markerCount = W.map.getLayersByName('houseNumberMarkers')[0].markers.length;
    for(let i=markerCount-1; i>-1; i--){
        currMarker = W.map.getLayersByName('houseNumberMarkers')[0].markers[i];
        W.model.actionManager.add(new DeleteHouseNumber(currMarker.model));
    }
})();</nowiki>}}


=== User information and communication ===
===User information and communication===


==== Create private message to user ====
====Create private message to user====
This script will use the mouse-selected (highlighted) text on the page to prepare a private message page with the username already populated. If you don't highlight a username, the script will ask for one to be entered.
This script will use the mouse-selected (highlighted) text on the page to prepare a private message page with the username already populated. If you don't highlight a username, the script will ask for one to be entered.


Line 159: Line 190:
</nowiki>}}
</nowiki>}}


==== Display user's forum posts ====
====Display user's forum posts====
This script will use the mouse-selected (highlighted) text on the page to display the user's forum posts. If you don't highlight a username, the script will ask for one to be entered.
This script will use the mouse-selected (highlighted) text on the page to display the user's forum posts. If you don't highlight a username, the script will ask for one to be entered.


Line 169: Line 200:
</nowiki>}}
</nowiki>}}


==== Display user's Wiki page ====
====Display user's Wiki page====
This script will use the mouse-selected (highlighted) text on the page to display the user's Wiki page. If you don't highlight a username, the script will ask for one to be entered.
This script will use the mouse-selected (highlighted) text on the page to display the user's Wiki page. If you don't highlight a username, the script will ask for one to be entered.


Line 177: Line 208:
</nowiki>}}
</nowiki>}}


==== Display user's Wiki contributions ====
====Display user's Wiki contributions====
This script will use the mouse-selected (highlighted) text on the page to display the user's Wiki contributions. If you don't highlight a username, the script will ask for one to be entered.
This script will use the mouse-selected (highlighted) text on the page to display the user's Wiki contributions. If you don't highlight a username, the script will ask for one to be entered.


Line 186: Line 217:




==== Get user's Editor profile ====
====Get user's Editor profile====
This script will use the mouse-selected (highlighted) text on the page to display the user's Editor profile on the forum. If you don't highlight a username, the script will ask for one to be entered.
This script will use the mouse-selected (highlighted) text on the page to display the user's Editor profile on the forum. If you don't highlight a username, the script will ask for one to be entered. This script opens a new browser tab.


<!-- Do not modify this code directly. Go to the talk page to modify the formatted code and then compress it and paste the result below -->
<!-- Do not modify this code directly. Go to the talk page to modify the formatted code and then compress it and paste the result below -->
Line 194: Line 225:
</nowiki>}}
</nowiki>}}


==== Get user's forum profile ====
====Get user's forum profile====
This script will use the mouse-selected (highlighted) text on the page to display the user's forum profile on the forum. If you don't highlight a username, the script will ask for one to be entered.
This script will use the mouse-selected (highlighted) text on the page to display the user's forum profile on the forum. If you don't highlight a username, the script will ask for one to be entered.


Line 202: Line 233:
</nowiki>}}
</nowiki>}}


=== Wiki and support pages ===
===Wiki and support pages===
==== Glossary Entries ====
====Glossary Entries====
This script will take you directly to the Waze [[Glossary]] entry for a highlighted or entered term.
This script will take you directly to the Waze [[Glossary]] entry for a highlighted or entered term. '''''Note:''' This BM will open the glossary in the USA local Wazeopedia, to have it redirect to a different local wiki, you can modify the beginning of the url to the correct locale.''
{{Pre2|<nowiki>javascript:(function() {var s=new String(''); /* BM V5 2015-04-19 */ if (window.getSelection) {s=window.getSelection().toString();} else if (document.getSelection) {s=document.getSelection().toString();} else if (document.selection) {s=document.selection.createRange().text.toString();} if (!s) {s=prompt('No text selected. Enter a Glossary Entry term here:');} if (s) {window.open('http://www.waze.com/wiki/Glossary#'+encodeURIComponent(s.replace(/ /g,'_')).replace(/%/g,'.').replace(/\(/g,'.28').replace(/\)/g,'.29'));}})();</nowiki>}}
{{Pre2|<nowiki>javascript:(function() {var s=new String(''); /* BM V6 2016-08-26 */ if (window.getSelection) {s=window.getSelection().toString();} else if (document.getSelection) {s=document.getSelection().toString();} else if (document.selection) {s=document.selection.createRange().text.toString();} if (!s) {s=prompt('No text selected. Enter a Glossary Entry term here:');} if (s) {window.open('https://wazeopedia.waze.com/wiki/USA/Glossary#'+encodeURIComponent(s.replace(/ /g,'_')).replace(/%/g,'.').replace(/\(/g,'.28').replace(/\)/g,'.29'));}})();</nowiki>}}
 
 
==== Purge Current Wiki Page ====
This Bookmarklet will purge the cached version of the current wiki page, causing it reload any included images, or transcluded templates.
{{Pre2|<nowiki>javascript: (function() /* BM V3 purge wiki page 2015-10-13 */ { var url = window.location.href; var test = url.search("index.php"); if (test <1) {window.open(url.replace(/\/wiki\//,'\/wiki\/index.php?action=purge&forcelinkupdate&title='));} else {window.open(url.replace(/\?.*(title=[^&]*).*/,'?action=purge&forcelinkupdate&$1'));} })();</nowiki>}}
 
=== Device ===
====Geocaching====
 
by {{username|davipt}}
 
''Geocaching-Waze bookmarklet'' is a iOS Safari bookmarklet that allows driving to a given Geocaching coordinate with Waze. It assumes a fixed flow within iOS and the official Geocaching client, but it could be adapted to other situations.


Open the iOS Geocaching app, pick up a cache, click on '''Open on external map''', which will open Google Maps on the browser. From this page, click on the bookmarklet which will display the lat+lon; then open Waze on that point, ready to drive there.
====Purge Current Wiki Page====
This Bookmarklet will purge the cached version of the current wiki page, causing it reload any included images, or transcluded templates. It has been updated to work on both the old wiki, and the new USA Wazeopedia.
{{Pre2|<nowiki>javascript: (function() /* BM V4 purge wiki page 2016-08-05 */ { var url = window.location.href;  var test = url.search("index.php"); var wazeopedia = url.search("wazeopedia.waze.com"); if (test <1) { if (wazeopedia <1) { window.open(url.replace(/\/wiki\//,'\/wiki\/index.php?action=purge&forcelinkupdate&title=')); } else { window.open(url.replace(/\/wiki\/([\w ]*\/)/,'\/wiki\/$1index.php?action=purge&forcelinkupdate&title=')); } } else { window.open(url.replace(/\?.*(title=[^&]*).*/,'?action=purge&forcelinkupdate&$1')); }})();</nowiki>}}


Set up:
====Open in Wazeopedia====
* open safari and open any webpage
This bookmarklet when deployed on any page in the legacy wiki (http://wiki.waze.com/wiki/), will open that same page in the USA local Wazeopedia (http://wazeopedia.waze.com/wiki/USA/). If deployed on a page in any Wazeopedia, it will open that page in the legacy wiki. If it detects that it's not on a legacy wiki or Wazeopedia page, it will prompt you to enter a <code><nowiki>{{PAGENAME}}</nowiki></code>, which it will then open in the USA local Wazeopedia.
* add the page as a bookmark, call it something ("Waze"?). At this point one can't change the location.
* open the bookmarks list, edit the bookmark, and change the location to the following text:
{{pre2|<nowiki>javascript:l=document.location.href;l=l.replace(/.*?(@|%40|%2540)/,"");l=l.replace(/.*?(-?[0-9.]*,-?[0-9.]*).*/,"$1");alert(l);document.location.href='waze://?ll='+l;</nowiki>}}


Then once this is set up, here's how to use it:
This code can be modified for use by any country by simply replacing <code>USA</code> with the correct code for the Wazeopedia links off your country.
* on the Geocaching client, pick the cache you want to drive to, and click on the "open on external map", which will open Safari and maps.google.com
* click on safari bookmarks and the waze bookmark
* an alert will show the "lat,lon", just in case, to ensure the value was parsed correctly (waze crashes if this value is incorrect btw)
* Waze will open with a marker at the cache's coordinate. click on the marker and drive there. Or manually pick a road nearby in case it's a cache with no access by car ;)


Feedback is welcomed.
{{Pre2|<nowiki>javascript: (function() /* BM V2 view wiki page in USA Wazeopedia page or vice versa 2016-08-12 */ { var url = window.location.href; var wiki = url.search("wiki.waze.com/wiki"); var wazeopedia = url.search("wazeopedia.waze.com/wiki"); if (wiki < 1 && wazeopedia < 1) { var response = prompt('This is not a page on the legacy Waze wiki. Please enter a PAGENAME here.'); if (response) { wiki = 1; url="https://wiki.waze.com/wiki/"+response; } else { return; } } if (wazeopedia < 1) { window.open(url.replace(/wiki.waze.com\/wiki\//i,"wazeopedia.waze.com/wiki/USA/")); } else { window.open(url.replace(/wazeopedia.waze.com\/wiki\/.*?\//i,"wiki.waze.com/wiki/")); } })();</nowiki>}}
{{Mbox|type=forum|text=Comments or questions on this bookmarklet can be brought up in the [http://www.waze.com/forum/viewtopic.php?f=3&t=36866 ''Geocaching-Waze bookmarklet'' forum thread]}}


[[Category:Bookmarklets]]
[[Category:Waze Map Editor]]

Latest revision as of 22:49, 31 October 2022

A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands to extend the browser's functionality through a single mouse click. For instance, a bookmarklet might enable the user to select an editor username on a page, click the bookmarklet, and be taken directly to the private message page with the username already entered.

Adding to a browser

Chrome

To add a bookmarklet to Google Chrome, you must open the Bookmark Manager. There are three methods to do this:

METHOD 1: Via Chrome's Menu option

Click image to enlarge
Click image to enlarge
  • Left click on the Chrome menu on the browser toolbar.
  • Hover over the "Bookmarks" menu and a drop-down menu will display
  • Left click on "Bookmark Manager"

METHOD 2: Bookmark menu

  • If you have the Bookmark Bar enabled, right-click anywhere on the Bookmark Bar
  • Scroll down to Bookmark Manager and left-click

METHOD 3: Shortcut key

  • Just use the shortcut Ctrl+ Shift+O or Cmd+ Option+B

After Opening the Bookmark menu:

  • In the left window pane, navigate to where you want to add the bookmarklet.
  • In the main window pane, right click to see the context menu.
  • Left click on "Add page"
  • In the "Name" box, enter any name you prefer to assist in identifying the bookmarklet. You could also leave it empty.
  • In the "URL" box, paste the code your previously copied.

When finished, it should look something like this:

Shortcut keys can be added with external add-on tools. One example is this tool.

Firefox

  • Ensure the Bookmarks toolbar is visible with a Right-click in a blank area of the Firefox tab row or menu bar area. Alternately you can open the Bookmarks window with Ctrl-B.
  • Right-click the bookmark bar or window and select New Bookmark.
  • Enter a name for the bookmarklet in the Name field.
  • The Location field is where you copy and paste the javascript code from one of the code boxes below. Be sure to include everything from the code box.
  • The other fields are not required. Press Add to save the changes.
  • Repeat the process for each bookmarklet desired.

Running Bookmarkets

Desktops:

Bookmarklets are easiest to use if you have your browser’s bookmarks toolbar enabled. Just click the bookmarklet and your browser will run it on the current page.

Mobile Safari:

If you don’t have a bookmarks toolbar — such as on Safari on an iPad or another mobile browser — just open your browser’s bookmarks pane and tap or click the bookmark.

Mobile Chrome:

  1. Pick a good name for it that you can get to auto-complete quickly.
  2. Type the name into the search bar when you want to run it.
  3. Tap the bookmarklet when it shows up in the drop-down.

Defined scripts

The following bookmarklet scripts could be helpful to map editors. Following the instructions above for adding a bookmarklet based on your browser, select the code below with your mouse, highlighting all the code inside the box. Use that code to paste into the bookmark as the target or location.

Formatted (viewable) code can be seen on the talk page.

Map location

Open Waze Map Editor from LiveMap

A script is no longer necessary. Click the "Edit the map" link when viewing Livemap.

Open LiveMap from Waze Map Editor

This script opens a window with Live Map when currently viewing Waze Map Editor.

javascript:(function(){var center_lonlat=OpenLayers.Layer.SphericalMercator.inverseMercator(g_map.getCenter().lon,g_map.getCenter().lat);var mapZoom=(window.location.hostname=='www.waze.com'?(g_map.zoom>6?(g_map.zoom>7?g_map.zoom-5:g_map.zoom-6):0):(g_map.zoom>10?g_map.zoom-11:0));window.open('http://'+window.location.hostname+'/editor/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'Waze Map Editor')})();

A drag-n-drop link can be copied from this dropbox page (AlanOfTheBerg's dropbox).

Map editing

You may not be granted edit points for making a large number of edits in a short time (usually only possible using scripts to edit).
See the Map protection page for detailed information.

Custom location scripts

If you know of a script for a specific area, please add it to this list or request help from this forum for it to be added.

Enable Pinch-to-Zoom Navigation

For mobile devices and tablets, this will enable two-fingered pinch zoom.

javascript:(function(){ol=function(n){var s=document.createElement('script');s.setAttribute('src','https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.12/lib/OpenLayers/'+n+'.js');document.body.appendChild(s);};ol('Control/PinchZoom');ol('Handler/Pinch');ol('Control/TouchNavigation');window.setTimeout(function(){Waze.map.addControl(new OpenLayers.Control.TouchNavigation);}, 100)}());

Reselect Segments from Permalink

This simply gets the list of segments IDs from the URL, and selects them again in WME.

javascript:if(q=window.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);}

Set segment locks in area

This script will set the lock rank on various segment types in the visible area of the WME. Note that the script uses levels one lower than the level will be applied, e.g., if the script says "fwy_lvl=4" then the Freeway will be locked at 5. Current configuration as listed in this script:

  • It will only update up to 150 segments
  • It only modifies what can be modified by the user's current rank and area
    • If the user's current rank is lower than the defined lock level, it will lock the roads at the user's rank
  • It will not lower a rank less than it is currently set
  • Freeways are set to 5
  • Ramps are set to 4
  • Major Highways are set to 4
  • Minor Highways are set to 3
  • Primary Streets are set to 2
  • Private Roads are set to 2
  • Railroads are set to 2
  • Ferries are set to 5
javascript: (function() { var fwy_lvl = 4; var rmp_lvl = 3; var maj_lvl = 3; var min_lvl = 2; var pri_lvl = 1; var prv_lvl = 1; var rr_lvl = 1; var fer_lvl = 4; var absolute = false; var count = 0; var thisUser = W.loginManager.user; if (thisUser === null) return; var usrRank = thisUser.normalizedLevel; var UpdateObject; if (typeof(require) !== "undefined") { UpdateObject = require("Waze/Action/UpdateObject"); } else { UpdateObject = W.Action.UpdateObject; } if (fwy_lvl > (usrRank - 1)) fwy_lvl = usrRank - 1; if (rmp_lvl > (usrRank - 1)) rmp_lvl = usrRank - 1; if (maj_lvl > (usrRank - 1)) maj_lvl = usrRank - 1; if (min_lvl > (usrRank - 1)) min_lvl = usrRank - 1; if (pri_lvl > (usrRank - 1)) pri_lvl = usrRank - 1; function onScreen(obj) { if (obj.geometry) { return (W.map.getExtent().intersectsBounds(obj.geometry.getBounds())); } return (false); } W.model.segments.getObjectArray().forEach(function(v) { if (count < 150 && onScreen(v) && v.isGeometryEditable()) { if (v.attributes.roadType == 3 && (v.attributes.lockRank < fwy_lvl || (absolute && v.attributes.lockRank != fwy_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: fwy_lvl })); } if (v.attributes.roadType == 4 && (v.attributes.lockRank < rmp_lvl || (absolute && v.attributes.lockRank != rmp_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: rmp_lvl })); } if (v.attributes.roadType == 6 && (v.attributes.lockRank < maj_lvl || (absolute && v.attributes.lockRank != maj_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: maj_lvl })); } if (v.attributes.roadType == 7 && (v.attributes.lockRank < min_lvl || (absolute && v.attributes.lockRank != min_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: min_lvl })); } if (v.attributes.roadType == 2 && (v.attributes.lockRank < pri_lvl || (absolute && v.attributes.lockRank != pri_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: pri_lvl })); } if (v.attributes.roadType == 17 && (v.attributes.lockRank < prv_lvl || (absolute && v.attributes.lockRank != prv_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: prv_lvl })); } if (v.attributes.roadType == 18 && (v.attributes.lockRank < rr_lvl || (absolute && v.attributes.lockRank != rr_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: rr_lvl })); } if (v.attributes.roadType == 15 && (v.attributes.lockRank < fer_lvl || (absolute && v.attributes.lockRank != fer_lvl))) { count++; W.model.actionManager.add(new UpdateObject(v, { lockRank: fer_lvl })); } } }); })();

Extraneous node remover

This script will remove extraneous junction nodes that are not required. It will not remove nodes that prevent the problems related to loops with too few segments. This function is similar to the feature built into the Toolbox, but it operates as a stand alone script from other tools.

javascript: (function() { var count = 0; var geo = W.map.getExtent().toGeometry(); _.each(W.model.nodes.objects, function(v, k) { if (count < 10) { if (v.areConnectionsEditable() && geo.containsPoint(v.geometry) && v.state != "Delete") { console.log(v); if (v.attributes.segIDs.length == 2) { var seg1 = W.model.segments.getObjectById(v.attributes.segIDs[0]); var seg2 = W.model.segments.getObjectById(v.attributes.segIDs[1]); if (seg1 && seg2 && seg1.attributes.primaryStreetID == seg2.attributes.primaryStreetID && seg1.attributes.roadType == seg2.attributes.roadType && seg1.isOneWay() == seg2.isOneWay() && seg1.isDrivable() && seg2.isDrivable() && !seg1.attributes.hasClosures && !seg2.attributes.hasClosures && seg1.attributes.junctionID == null && seg2.attributes.junctionID == null && seg1.attributes.level == seg2.attributes.level && seg1.attributes.flags == seg2.attributes.flags && seg1.attributes.fwdToll == seg2.attributes.fwdToll && seg1.attributes.lockRank == seg2.attributes.lockRank && seg1.attributes.rank == seg2.attributes.rank) { var update = true; if (seg1.attributes.toNodeID == seg1.attributes.fromNodeID || seg2.attributes.toNodeID == seg2.attributes.fromNodeID) { update = false; } if (seg1.attributes.toNodeID != v.attributes.id && (seg1.attributes.toNodeID == seg2.attributes.toNodeID || seg1.attributes.toNodeID == seg2.attributes.fromNodeID)) { update = false; } if (seg1.attributes.fromNodeID != v.attributes.id && (seg1.attributes.fromNodeID == seg2.attributes.toNodeID || seg1.attributes.fromNodeID == seg2.attributes.fromNodeID)) { update = false; } if (update) { var n1, n2; if (seg1.attributes.toNodeID == v.attributes.id) n1 = W.model.nodes.getObjectById(seg1.attributes.fromNodeID); else n1 = W.model.nodes.getObjectById(seg1.attributes.toNodeID); if (seg2.attributes.toNodeID == v.attributes.id) n2 = W.model.nodes.getObjectById(seg2.attributes.fromNodeID); else n2 = W.model.nodes.getObjectById(seg2.attributes.toNodeID); for (var i = 0; i < n1.attributes.segIDs.length; i++) { for (var j = 0; j < n2.attributes.segIDs.length; j++) { if (n1.attributes.segIDs[i] == n2.attributes.segIDs[j]) { console.log("Merge on", v.attributes.id, "would cause two or more segments connected to same nodes."); update = false; } if (update == false) break; } if (update == false) break; } } if (update) { var MergeSegments = require('Waze/Action/MergeSegments'); W.model.actionManager.add(new MergeSegments(seg1, seg2, v)); count++; console.log("merged(" + count + ") " + seg1.id + " with " + seg2.id + " at " + v.attributes.id); } } } } } }); })();

Geometry Node Wiper (GeoWipe)

Completely straightens all selected segments by removing all geometry nodes. DO NOT USE this on segments which are supposed to curve or have doglegs on them for navigational aids.

javascript:(function() {var UpdateSegmentGeometry=require("Waze/Action/UpdateSegmentGeometry");   _.each(Waze.selectionManager.selectedItems, function(k, va) {v=va.model;if (v && v.type == "segment" && v.geometry.components.length > 2) {var geo = v.geometry.clone();         geo.components.splice(1,geo.components.length-2);geo.components[0].calculateBounds();         geo.components[1].calculateBounds();Waze.model.actionManager.add(new UpdateSegmentGeometry(v, v.geometry, geo));}});})();

Segment Length

Displays the selected segment's length (similar to the Toolbox Measure tool) in both imperial and metric values, rounded to 2 decimals. This is intended for editors that are not able to use scripts on their PC, therefore can only see the segment length in whole meters (which when viewing in imperial is therefore rounded incorrectly) in the left panel of WME.

javascript: (function() { var length = 0; if(W.selectionManager.getSelectedFeatures().length === 1){ var segment = W.selectionManager.getSelectedFeatures()[0]; var line = new OL.Geometry.LineString(segment.geometry.components); length = line.getGeodesicLength(W.map.getProjectionObject()); alert(Math.round((length * 100))/100 + "m" + "\n" + Math.round((length * 3.28084 * 100))/100 + "ft");}})();

Clear House Numbers

Clears all house numbers from a segment. Must be in the House Number editor when this bookmarklet is run.

javascript: (function() {
    let DeleteHouseNumber = require('Waze/Actions/DeleteHouseNumber');
    let currMarker;
    let markerCount = W.map.getLayersByName('houseNumberMarkers')[0].markers.length;
    for(let i=markerCount-1; i>-1; i--){
        currMarker = W.map.getLayersByName('houseNumberMarkers')[0].markers[i];
        W.model.actionManager.add(new DeleteHouseNumber(currMarker.model));
    }
})();

User information and communication

Create private message to user

This script will use the mouse-selected (highlighted) text on the page to prepare a private message page with the username already populated. If you don't highlight a username, the script will ask for one to be entered.

javascript:(function(){var s='';if(window.getSelection){s=window.getSelection()}else if(document.getSelection){s=document.getSelection()}else if(document.selection){s=document.selection.createRange().text}if(s==""){var s=prompt("Enter Username for sending PM (or highlight name before selecting bookmarklet).")}if((s!="")&&(s!=null)){window.location.href="http://www.waze.com/forum/ucp.php?i=pm&mode=compose&username="+s}})();

Display user's forum posts

This script will use the mouse-selected (highlighted) text on the page to display the user's forum posts. If you don't highlight a username, the script will ask for one to be entered.

Once on that page, selecting any entry of the user's name will move to the user's forum profile data.

javascript:(function(){var s='';if(window.getSelection){s=window.getSelection()}else if(document.getSelection){s=document.getSelection()}else if(document.selection){s=document.selection.createRange().text}if(s==""){var s=prompt("Enter Username to view forum posts (or highlight name before selecting bookmarklet).")}if((s!="")&&(s!=null)){window.location.href="http://www.waze.com/forum/search.php?keywords=&terms=all&sv=0&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search&author="+s}})();

Display user's Wiki page

This script will use the mouse-selected (highlighted) text on the page to display the user's Wiki page. If you don't highlight a username, the script will ask for one to be entered.

javascript:(function(){var s='';if(window.getSelection){s=window.getSelection()}else if(document.getSelection){s=document.getSelection()}else if(document.selection){s=document.selection.createRange().text}if(s==""){var s=prompt("Enter Username for Wiki user page (or highlight name before selecting bookmarklet).")}if((s!="")&&(s!=null)){window.location.href="http://wiki.waze.com/wiki/User:"+s}})();

Display user's Wiki contributions

This script will use the mouse-selected (highlighted) text on the page to display the user's Wiki contributions. If you don't highlight a username, the script will ask for one to be entered.

javascript:(function(){var s='';if(window.getSelection){s=window.getSelection()}else if(document.getSelection){s=document.getSelection()}else if(document.selection){s=document.selection.createRange().text}if(s==""){var s=prompt("Enter Username for Wiki contributions (or highlight name before selecting bookmarklet).")}if((s!="")&&(s!=null)){window.location.href="http://wiki.waze.com/wiki/Special:Contributions/"+s}})();


Get user's Editor profile

This script will use the mouse-selected (highlighted) text on the page to display the user's Editor profile on the forum. If you don't highlight a username, the script will ask for one to be entered. This script opens a new browser tab.

javascript:(function(){var s='';if(window.getSelection){s= window.getSelection();}else if(document.getSelection){s= document.getSelection();}else if(document.selection){s= document.selection.createRange().text;}if(s==''){s=prompt("Enter Wazer name here or highlight name before using this bookmarklet.");}if((s != '')&&(s !=null)){window.open('http://www.waze.com/user/editor/'+s);}})();

Get user's forum profile

This script will use the mouse-selected (highlighted) text on the page to display the user's forum profile on the forum. If you don't highlight a username, the script will ask for one to be entered.

javascript:(function(){var s='';if(window.getSelection){s=window.getSelection()}else if(document.getSelection){s=document.getSelection()}else if(document.selection){s=document.selection.createRange().text}if(s==""){var s=prompt("Enter Username to view profile (or highlight name before selecting bookmarklet).")}if((s!="")&&(s!=null)){window.location.href="http://www.waze.com/forum/memberlist.php?do=getall&username="+s}})();

Wiki and support pages

Glossary Entries

This script will take you directly to the Waze Glossary entry for a highlighted or entered term. Note: This BM will open the glossary in the USA local Wazeopedia, to have it redirect to a different local wiki, you can modify the beginning of the url to the correct locale.

javascript:(function() {var s=new String(''); /* BM V6 2016-08-26 */ if (window.getSelection) {s=window.getSelection().toString();} else if (document.getSelection) {s=document.getSelection().toString();} else if (document.selection) {s=document.selection.createRange().text.toString();} if (!s) {s=prompt('No text selected. Enter a Glossary Entry term here:');} if (s) {window.open('https://wazeopedia.waze.com/wiki/USA/Glossary#'+encodeURIComponent(s.replace(/ /g,'_')).replace(/%/g,'.').replace(/\(/g,'.28').replace(/\)/g,'.29'));}})();

Purge Current Wiki Page

This Bookmarklet will purge the cached version of the current wiki page, causing it reload any included images, or transcluded templates. It has been updated to work on both the old wiki, and the new USA Wazeopedia.

javascript: (function() /* BM V4 purge wiki page 2016-08-05 */ { var url = window.location.href;  var test = url.search("index.php"); var wazeopedia = url.search("wazeopedia.waze.com"); if (test <1) { if (wazeopedia <1) { window.open(url.replace(/\/wiki\//,'\/wiki\/index.php?action=purge&forcelinkupdate&title=')); } else { window.open(url.replace(/\/wiki\/([\w ]*\/)/,'\/wiki\/$1index.php?action=purge&forcelinkupdate&title=')); } } else { window.open(url.replace(/\?.*(title=[^&]*).*/,'?action=purge&forcelinkupdate&$1')); }})();

Open in Wazeopedia

This bookmarklet when deployed on any page in the legacy wiki (http://wiki.waze.com/wiki/), will open that same page in the USA local Wazeopedia (http://wazeopedia.waze.com/wiki/USA/). If deployed on a page in any Wazeopedia, it will open that page in the legacy wiki. If it detects that it's not on a legacy wiki or Wazeopedia page, it will prompt you to enter a {{PAGENAME}}, which it will then open in the USA local Wazeopedia.

This code can be modified for use by any country by simply replacing USA with the correct code for the Wazeopedia links off your country.

javascript: (function() /* BM V2 view wiki page in USA Wazeopedia page or vice versa 2016-08-12 */ { var url = window.location.href; var wiki = url.search("wiki.waze.com/wiki"); var wazeopedia = url.search("wazeopedia.waze.com/wiki"); if (wiki < 1 && wazeopedia < 1) { var response = prompt('This is not a page on the legacy Waze wiki. Please enter a PAGENAME here.'); if (response) { wiki = 1; url="https://wiki.waze.com/wiki/"+response; } else { return; } } if (wazeopedia < 1) { window.open(url.replace(/wiki.waze.com\/wiki\//i,"wazeopedia.waze.com/wiki/USA/")); } else { window.open(url.replace(/wazeopedia.waze.com\/wiki\/.*?\//i,"wiki.waze.com/wiki/")); } })();