Bookmarklets: Difference between revisions View history

imported>Fredo-p
m (→‎Chrome: added Chrome Menu icon and reworded a few areas)
imported>Forumtestuser
m (1 revision imported)
 
(50 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{construction
#REDIRECT [[USA:Bookmarklets]]
| 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.
 
== Adding to a browser ==
 
=== Chrome ===
{{NeedInfo|These instructions have not yet been verified for Chrome.}}
[[File:Chrome-menu-button.png|right]]
* Left click on the Chrome menu button in the upper right corner of your browser. (three horizontal bars)
 
* Hoover over the "Bookmarks" menu and a drop-down menu will display
 
* Left click on "Bookmark Manager"
 
* 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 "Wazer Profile" or any name you prefer for the new bookmarklet.
 
* In the "URL" box, paste the code your previously copied.
 
While other methods exist, this method should always work.
 
=== 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.
 
== 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:Bookmarklets#Expanded views|talk page]].''
 
<!-- this link has a script that needs to be added. https://www.waze.com/forum/viewtopic.php?f=12&t=17684#p431249 -->
=== Map editing ===
 
==== Open Waze Map Editor from LiveMap ====
This script opens a window with [[Waze Map Editor]] when currently viewing LiveMap.
 
<!-- 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>
javascript:(function(){var center_lonlat=new OpenLayers.LonLat(wazeMap.center.lon,wazeMap.center.lat);center_lonlat.transform(new OpenLayers.Projection('EPSG:900913'),new OpenLayers.Projection('EPSG:4326'));var mapZoom=(window.location.hostname=='world.waze.com'?(wazeMap.zoom<5?(wazeMap.zoom<2?wazeMap.zoom+6:wazeMap.zoom+5):9):(wazeMap.zoom<5?wazeMap.zoom+11:15));window.open('http://'+window.location.hostname+'/livemap/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'LiveMap')})();
</nowiki>}}
 
''A drag-n-drop link can be copied from [http://dl.dropbox.com/u/1437031/waze_bookmarklets.html this dropbox page] (AlanOfTheBerg's dropbox).''
 
==== Open LiveMap from Waze Map Editor ====
This script opens a window with [[Live Map]] when currently viewing Waze Map Editor.
 
<!-- 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>
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')})();
</nowiki>}}
 
''A drag-n-drop link can be copied from [http://dl.dropbox.com/u/1437031/waze_bookmarklets.html this dropbox page] (AlanOfTheBerg's dropbox).''
 
==== 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.
 
* [[Michigan mapping resources|Michigan]]
* [[New York mapping resources|New York]]
 
==== 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:
 
* It will only update up to 150 segments
* It only modifies what can be modified by the user's current rank and area
* It will not lower a rank less than it is currently set
* Freeways and Ramps are set to 4
* Major Highways are set to 3
* Minor Highways are set to 2
* Primary Streets are set to 2
 
<!-- 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>
javascript:(function(){var fwy_lvl=3;var rmp_lvl=3;var maj_lvl=2;var min_lvl=1;var pri_lvl=1;var absolute=false;var count=0;Object.forEach(W.model.segments.objects,function(k,v){if(count<150&&v.onScreen()&&v.isGeometryEditable()){if(v.attributes.roadType==3&&(v.attributes.lockRank<fwy_lvl||(absolute&&v.attributes.lockRank!=fwy_lvl))){count++;W.model.actionManager.add(new Waze.Action.UpdateSegmentDetails(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 Waze.Action.UpdateSegmentDetails(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 Waze.Action.UpdateSegmentDetails(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 Waze.Action.UpdateSegmentDetails(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 Waze.Action.UpdateSegmentDetails(v,{lockRank:pri_lvl}))}}})})();
</nowiki>}}
 
=== 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.
 
<!-- 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>
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}})();
</nowiki>}}
 
==== 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.
 
<!-- 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>
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}})();
</nowiki>}}
 
==== 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.
 
<!-- 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>
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}})();
</nowiki>}}
 
==== 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.
 
<!-- 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>
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}})();
</nowiki>}}
 
 
[[Category:Bookmarklets]]

Latest revision as of 18:16, 8 January 2022

Redirect to: