WME Open GMaps Editor

Opens the Google Maps editor based on WME's map center.

当前为 2025-06-23 提交的版本,查看 最新版本

// ==UserScript==
// @name         WME Open GMaps Editor
// @namespace    https://github.com/WazeDev/wme-open-gmaps-editor
// @version      0.0.2
// @description  Opens the Google Maps editor based on WME's map center.
// @author       Gavin Canon-Phratsachack (https://github.com/gncnpk)
// @match        https://beta.waze.com/*editor*
// @match        https://www.waze.com/*editor*
// @exclude      https://www.waze.com/*user/*editor/*
// @exclude      https://www.waze.com/discuss/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=waze.com
// @license      MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    let wmeSdk;
    const zoomLevels = {
        1:  52428800,
        2:  26214400,
        3:  13107200,
        4:  6553600,
        5:  3276800,
        6:  1638400,
        7:  819200,
        8:  409600,
        9:  204800,
        10: 102400,
        11: 51200,
        12: 25600,
        13: 12800,
        14: 6400,
        15: 3200,
        16: 1600,
        17: 800,
        18: 400,
        19: 200,
        20: 100,
        21: 50,
        22: 25
    }
    window.SDK_INITIALIZED.then(initialize)
    async function initialize() {
        wmeSdk = await getWmeSdk({
            scriptId: 'wme-open-gmaps-editor',
            scriptName: 'WME Open GMaps Editor'
        })
        wmeSdk.Events.on({eventHandler: replaceGoogleLink, eventName: "wme-map-move-end"})
        wmeSdk.Events.on({eventHandler: replaceGoogleLink, eventName: "wme-map-zoom-changed"})
        replaceGoogleLink();
     }
    function replaceGoogleLink() {
        const coords = wmeSdk.Map.getMapCenter();
        const mapZoom = wmeSdk.Map.getZoomLevel();
        let url = `https://www.google.com/maps/place/@${coords.lat},${coords.lon},${zoomLevels[mapZoom]}m/data=!10m2!1e3!2e14`
        document.getElementsByClassName("wz-map-ol-control-google-map-permalink")[0].children[0].href = url;
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址