// ==UserScript==
// @name Waze Old LiveMap
// @namespace http://pyrczak.pl/
// @description Add to livemap old livemap, and function to (dirty) refresh tiles
// @include https://*.waze.com/*/livemap/*
// @include https://*.waze.com/*/livemap*
// @version 0.2.2
// @grant none
// @license MIT/WTFPL czy co tam chcesz
// @run-at document-end
// ==/UserScript==
function waze_old_livemap() {
function waze_old_addmap() {
L.control.attribution("bottomright").addTo(W.controller._mapView.map)
L.control.layers(
{}, // base layers, dont use unless you get from somewere leflet object with oryginal_new livemap base layer
{ // overlay layers
// "Old Waze LiveMap": L.tileLayer("http://tilesworld{c}.waze.com/tiles/{z}/{x}/{y}.png",{ "c": function(a){switch(a.s){case 'a':return 1;break;case 'b':return 2;break;default:return 3;}}}),
"OpenStreetMap@Mapnik": L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© autorzy OpenStreetMap"}),
"UMP@Mapnik": L.tileLayer("http://{c}.tiles.ump.waw.pl/ump_tiles/{z}/{x}/{y}.png",{attribution:"Data by UMP-pcPL+SRTM","c": function(a){switch(a.s){case 'a':return 1;break;case 'b':return 2;break;default:return 3;}}}),
"MapBox Satellite & OSM": L.tileLayer("https://{s}.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoidGtycGwiLCJhIjoiY2pjaHJ4Mjc4MWZ2MTJ3czc3dGtkNXExaiJ9.Lt6mR5OngFUX2QoV6e-X-A",{attribution:"© MapBox, © autorzy OpenStreetMap"}),
// "Cieniowanie NASA SRTMv2":L.tileLayer("http://tiles2.openpistemap.org/landshaded/{z}/{x}/{y}.png",{attribution:"(NASA SRTM3 v2)"}),
// "Cieniowanie NASA SRTMv2 (zaznacz oba aby było wyraźniejsze)":L.tileLayer("http://tiles2.openpistemap.org/landshaded/{z}/{x}/{y}.png",{attribution:"(NASA SRTM3 v2)"}),
// "Force Refresh old LiveMap (dirty)": L.tileLayer("http://tilesworld{c}.waze.com/tiles/{z}/{x}/{y}.png/dirty",{ "c": function(a){switch(a.s){case 'a':return 1;break;case 'b':return 2;break;default:return 3;}}})
}
).addTo(W.controller._mapView.map);
I18n.translations.pl.units.system="metric";
W.Model.RouteSearch.prototype.queryDefaults.nPaths=6
}
function waze_old_bootstrap() {
try {
if (typeof W.controller._mapView.map != undefined) {
setTimeout(waze_old_addmap, 100);
} else {
setTimeout(waze_old_bootstrap, 1000);
}
} catch(err) {
setTimeout(waze_old_bootstrap, 1000);
}
}
waze_old_bootstrap();
}
var DLscript = document.createElement("script");
DLscript.textContent ='\n'+
waze_old_livemap.toString()+' \n'+
'waze_old_livemap();';
DLscript.setAttribute("type", "application/javascript");
document.body.appendChild(DLscript);
document.body.removeChild(DLscript);