Open WME in Google Maps

Opens the current Waze Map Editor view in Google Maps

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name            Open WME in Google Maps
// @description     Opens the current Waze Map Editor view in Google Maps
// @namespace       vaindil
// @version         1.1
// @grant           none
// @include         https://www.waze.com/editor/*
// @include         https://www.waze.com/*/editor/*
// @include         https://beta.waze.com/editor/*
// @include         https://beta.waze.com/*/editor/*
// @exclude         https://www.waze.com/user/*
// @exclude         https://www.waze.com/*/user/*
// @author          vaindil
// ==/UserScript==

console.log("WMEGM BEGINNING");

var icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAFV0lEQVRIx32VX4xdVRnFf9/+c+69c2fuzDh25s6UWErHzgy0U6CIYG0pA4HyQh0TE31RE/pQNKQSNTxpNP558qGaVkVq0gaiCRDAKGYCFGKMmGqHAkI0rSWxGirQznXamfvvnL0/H+6dO3fGxH3OyTl7J2fttda39t6y5ekv9UgaH1HVQwb6FaV9oyiqCqzrK0SUnmbgrotNZs8vsflqEycGenowvaW6Ha2+4DYuH3CSxkeM8k0QFEXa7//XAspAI/LdUxVuu7hEQyIBIaqi1SqxspDX+uj9agtPO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3oERRSiwusXhCzCzZuUGIVk8zj1fAHTLu5KDTp7QGjZEo/fsBB7jTpUeen8vfrTMw9IVIOsHHNdip8+bSj4qPu2IbneXsrex4WFBQkhiLR3PKPaSsvugWr9+ekPQq9Rh6nz4j/2cuS1ByVEu2YlrgaiRerxPzqZe8tSSNCeYtGMjo7GJEnSzt6VKdwzVF86PrVoeyweU9Vfn/sUPzz9EI0s12LeHeHWeloNRIQTrzp+ccpTcFG997ZcLksul6upKmZrMb385PbLoWijh6AvvXOPPnrmAFFN56DsZs26rUXa40+dtvLMvCiqaq11IyMjKVCxf/3+hoEEcze2xssX9tR+NH/Ip9FLd2x1nffdne7JX/+noT8fl64f01xUm+vr6/22/d7XrvkTplaa+/v9Q4fnvzKSBi/rYP4HdP3nqjKR1y7YnFF986bNekTEHf4vYx67NSB7cBcAAAAASUVORK5CYII=';
var zooms = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22];

function gen_url() {
    var projI=new OpenLayers.Projection("EPSG:900913");
    var projE=new OpenLayers.Projection("EPSG:4326");
    var center_lonlat=(new OpenLayers.LonLat(Waze.map.center.lon,Waze.map.center.lat)).transform(projI, projE);
    lat=Math.round(center_lonlat.lat * 1000000)/1000000;
    lon=Math.round(center_lonlat.lon * 1000000)/1000000;
    return 'https://www.google.com/maps/@'+lat+','+lon+','+zooms[W.map.zoom]+'z';
}

function init() {
    try {
        var element = $('.WazeControlPermalink');
        if ($(element).length) {
            $('.WazeControlPermalink').prepend('<img src="' + icon + '" id="WMEtoGM" alt="GM" style="margin:0 5px 5px 0;cursor:pointer" />');
            $('#WMEtoGM').click(function() {
                window.open(gen_url(), '_blank');
            });
            console.log("WMEGM done");
        } else {
            setTimeout(init, 1000);
        }
    } catch (err) {
        console.log("WMEGM - " + err);
        setTimeout(init, 1000);
    }
}

init();