Talk:Bookmarklets Discussion View history

(Section moved into main talk content.)
(Updated formatting to {{Pre2}})
Line 6: Line 6:
==== Open Waze Map Editor from LiveMap ====
==== Open Waze Map Editor from LiveMap ====
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">
{{pre2|<nowiki>
javascript:(function(){
javascript:(function(){
     var center_lonlat=new OpenLayers.LonLat(wazeMap.center.lon,wazeMap.center.lat);
     var center_lonlat=new OpenLayers.LonLat(wazeMap.center.lon,wazeMap.center.lat);
Line 13: Line 13:
     window.open('http://'+window.location.hostname+'/livemap/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'LiveMap');
     window.open('http://'+window.location.hostname+'/livemap/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'LiveMap');
})();
})();
</pre>
</nowiki>}}


==== Open LiveMap from Waze Map Editor ====
==== Open LiveMap from Waze Map Editor ====
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">
{{pre2|<nowiki>
javascript:(function(){
javascript:(function(){
     var center_lonlat=OpenLayers.Layer.SphericalMercator.inverseMercator(g_map.getCenter().lon,g_map.getCenter().lat);
     var center_lonlat=OpenLayers.Layer.SphericalMercator.inverseMercator(g_map.getCenter().lon,g_map.getCenter().lat);
Line 23: Line 23:
     window.open('http://'+window.location.hostname+'/editor/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'Waze Map Editor');
     window.open('http://'+window.location.hostname+'/editor/?zoom='+mapZoom+'&lon='+center_lonlat.lon+'&lat='+center_lonlat.lat,'Waze Map Editor');
})();
})();
</pre>
</nowiki>}}




Line 30: Line 30:
==== Create private message for user ====
==== Create private message for user ====
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">
{{pre2|<nowiki>
javascript:(function(){
javascript:(function(){
     var s = '';
     var s = '';
Line 47: Line 47:
     }
     }
})();
})();
</pre>
</nowiki>}}


==== Display user's forum posts ====
==== Display user's forum posts ====
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">
{{pre2|<nowiki>
javascript:(function(){
javascript:(function(){
     var s = '';
     var s = '';
Line 68: Line 68:
     }
     }
})();
})();
</pre>
</nowiki>}}


==== Display user's Wiki page ====
==== Display user's Wiki page ====
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">
{{pre2|<nowiki>
javascript:(function(){
javascript:(function(){
     var s = '';
     var s = '';
Line 89: Line 89:
     }
     }
})();
})();
</pre>
</nowiki>}}


==== Display user's Wiki contributions ====
==== Display user's Wiki contributions ====
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<!-- After modifying this code, be sure to compress it as discussed above and paste into the same section heading on the main Bookmarklets page -->
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">
{{pre2|<nowiki>
javascript:(function(){
javascript:(function(){
     var s = "";
     var s = "";
Line 110: Line 110:
     }
     }
})();
})();
</pre>
</nowiki>}}

Revision as of 00:19, 7 June 2014

Expanded views

These expanded view scripts serve as the source for the scripts on Bookmarklets. Be sure when updating any of the scripts on that page that the update is first done with this code and then pass the code through a Javascript compressor like this one and then paste that result into the main page.

Map editing

Open Waze Map Editor from LiveMap

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');
})();

Open LiveMap from 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');
})();


User information and communication

Create private message for user

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

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

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

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;
    }
})();