WME-MapLinks

Adds links to other maps

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey oder Violentmonkey installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey oder Violentmonkey installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey oder Userscripts installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey installieren.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

Um dieses Design zu installieren, müssen Sie eine Erweiterung wie Stylus installieren.

Um dieses Design zu installieren, müssen Sie eine Erweiterung wie Stylus installieren.

Um dieses Design zu installieren, müssen Sie eine Erweiterung wie Stylus installieren.

Um diesen Stil zu installieren, müssen Sie eine Erweiterung für den Benutzerstil Verwaltung installieren.

Um diesen Stil zu installieren, müssen Sie eine Erweiterung für den Benutzerstil Verwaltung installieren.

Um diesen Stil zu installieren, müssen Sie eine Erweiterung für den Benutzerstil Verwaltung installieren.

(Ich habe bereits einen Benutzerstil Verwaltung, ich möchte ihn installieren!)

// ==UserScript==
// @name 			WME-MapLinks
// @description 	Adds links to other maps
// @namespace 		http://tampermonkey.net/
// @author          Robin Breman | L4 Waze NL | @robbre | https://github.com/RobinBreman/WME-MapLinks
// @match           *://*.waze.com/*editor*
// @exclude         *://*.waze.com/user/editor*
// @grant 			none
// @require         https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.8.0/proj4.js
// @version 		1.4.3
// @supportURL   https://github.com/RobinBreman/WME-MapLinks/issues
// @homepageURL  https://github.com/RobinBreman/WME-MapLinks
// @run-at       document-end      // After DOM loads (default)
// ==/UserScript==

(function () {
    'use strict';

const version = '1.4.2';
let W;
const mapLinksRegistry = [
    {
        id: 'BAG',
        icon: 'https://www.kadaster.nl/favicon.ico',
        title: 'BAG',
        handler: gotoBAGViewer
    },
    {
        id: 'George',
        icon: 'https://wegkenmerken.staging.ndw.nu/favicon.ico',
        title: 'George',
        handler: gotoGeorge
    },
    {
        id: 'GoogleMaps',
        icon: 'https://www.google.com/favicon.ico',
        title: 'Google Maps',
        handler: gotoGoogleMaps
    },
    {
        id: 'MatrixNL',
        icon: 'https://matrixnl.nl/favicon.ico',
        title: 'MatrixNL',
        handler: gotoMatrixNL
    },
    {
        id: 'Mapillary',
        icon: 'https://static.xx.fbcdn.net/rsrc.php/v3/yh/r/tMT3WIParw8.png',
        title: 'Mapillary',
        handler: gotoMapillary
    },
    {
        id: 'Melvin',
        icon: 'https://melvin.ndw.nu/assets/icon/favicon-32.png',
        title: 'Melvin',
        handler: gotoMelvin
    },
    {
        id: 'NDW',
        icon: 'https://www.arcgis.com/favicon.ico',
        title: 'NDW',
        handler: gotoNDW
    },
    {
        id: 'Omgevingswet',
        icon: 'https://omgevingswet.overheid.nl/favicon.ico',
        title: 'Omgevingswet',
        handler: gotoOmgevingswet
    },
    {
        id: 'Satellietdataportaal',
        icon: 'https://www.satellietdataportaal.nl/favicon.ico',
        title: 'Satellietdataportaal',
        handler: gotoSDP
    },
    {
        id: 'Wegstatus',
        icon: 'https://www.wegstatus.nl/favicon.ico',
        title: 'Wegstatus',
        handler: gotoWegstatus
    },
    {
        id: 'Wegstatus 3.0',
        icon: 'https://dashboard.wegstatus.nl/favicon.svg',
        title: 'Wegstatus 3.0',
        handler: gotoWegstatus3
    }
];
function WMEML_InitScript() {
    console.log(`WME-MapLinks v${version} initializing...`);
    // initialize the sdk with your script id and script name
    if (!window.getWmeSdk) {
        throw new Error("SDK not available");
    }
    W = window.getWmeSdk({ scriptId: "WME-MapLinks", scriptName: "WME-MapLinks" });
    // Start using the SDK
    const mapCenter = W.Map.getMapCenter();
    const topCountry = W.DataModel.Countries.getTopCountry();
    W.Events.once({ eventName: "wme-ready" }).then(() => { addMapLinks(); });
}
function addMapLinks() {
    const buttonHTML = $(`
        <style>
            #WMEMapLinksButtons {
                display: flex;
                gap: 4px;
            }
            #WMEMapLinksButtons button {
                background-color: var(--background-variant, #f5f5f5);
                border: 1px solid var(--border-primary, #ccc);
                border-radius: 4px;
                padding: 6px;
                cursor: pointer;
                transition: background-color 0.2s;
            }
            #WMEMapLinksButtons button:hover {
                background-color: var(--background-hover, #e8e8e8);
            }
            #WMEMapLinksButtons button:active {
                background-color: var(--background-active, #d0d0d0);
            }
            #WMEMapLinksButtons img { 
                height: 18px;
                max-width: 20px;
                display: block;
            }
            
            /* Dark theme support */
            .dark-theme #WMEMapLinksButtons button {
                background-color: var(--background-variant, #2d2d2d);
                border-color: var(--border-primary, #404040);
            }
            .dark-theme #WMEMapLinksButtons button:hover {
                background-color: var(--background-hover, #3d3d3d);
            }
        </style>
        <div id='MapLinksDiv'>
            <div id='WMEMapLinksButtons'></div>
        </div>
    `);
    $('div.secondary-toolbar').before(buttonHTML);
    mapLinksRegistry.forEach(linkItem => {
        const btn = $(`
                <button id='WMEMapLinksButton_${linkItem.id}' title='${linkItem.title}'>
                    <img src='${linkItem.icon}'>
                </button>
            `);
        btn.click(linkItem.handler);
        $('#WMEMapLinksButtons').append(btn);
    });
}
function getMapCoordinates() {
    const mapCenter = W.Map.getMapCenter();
    return {
        y: mapCenter.lat, //latMatch ? parseFloat(latMatch[1]) : 0,
        x: mapCenter.lon //lonMatch ? parseFloat(lonMatch[1]) : 0
    };
}
function getMapZoomlevel() {
    const zoomLevel = W.Map.getZoomLevel();
    return zoomLevel;
}
function gotoMelvin() {
    const coords = getMapCoordinates();
    const url = `https://melvin.ndw.nu/public?sw=${coords.y},${coords.x}&ne=${coords.y},${coords.x}`;
    window.open(url, '_blank');
}
function gotoOmgevingswet() {
    const coords = getMapCoordinates();
    const url = `https://omgevingswet.overheid.nl/regels-op-de-kaart/documenten?regelsandere=regels&locatie-stelsel=ETRS89&locatie-x=${coords.x}&locatie-y=${coords.y}`;
    window.open(url, '_blank');
}
function gotoBAGViewer() {
    proj4.defs('EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.2369,50.0087,465.658,0.406857330322398,0.350732676542563,-1.87034738360657,4.0812 +units=m +no_defs');
    const coords = getMapCoordinates();
    const rdCoords = proj4('EPSG:4326', 'EPSG:28992', [coords.x, coords.y]);
    const url = `https://bagviewer.kadaster.nl/lvbag/bag-viewer/?theme=BRT+Achtergrond&geometry.x=${rdCoords[0]}&geometry.y=${rdCoords[1]}&zoomlevel=13.776830703977048`;
    window.open(url, '_blank');
}
function gotoMapillary() {
    const coords = getMapCoordinates();
    const zoom = getMapZoomlevel();
    const url = `https://www.mapillary.com/app/?lat=${coords.y}&lng=${coords.x}&z=${zoom}`;
    window.open(url, '_blank');
}
function gotoSDP() {
    const coords = getMapCoordinates();
    const zoom = getMapZoomlevel();
    const url = `https://viewer.satellietdataportaal.nl/@${coords.y},${coords.x},${zoom}`;
    window.open(url, '_blank');
}
function gotoWegstatus() {
    const coords = getMapCoordinates();
    const lat = coords.y.toString().replace('.', 'd');
    const lon = coords.x.toString().replace('.', 'd');
    const url = `https://www.wegstatus.nl/dashboardnl_old/lat=${lat}%7Clon=${lon}`;
    window.open(url, '_blank');
}
function gotoWegstatus3() {
    //https://dashboard.wegstatus.nl/dashboard/nederland?lat=52.874052&lng=5.746153&z=16
    const coords = getMapCoordinates();
    const zoom = getMapZoomlevel();
    // const url = `https://dashboard.wegstatus.nl/dashboard/nederland?lat=${coords.y}&lng=${coords.x}&z=${zoom}`;
    const url = `https://dashboard.roadstatus.eu/dashboard/nederland?lat=${coords.y}&lng=${coords.x}&z=${zoom}`;
    window.open(url, '_blank');
}
function gotoGeorge() {
    //https://wegkenmerken.ndw.nu/kaart?kaartlagen=BRT&zichtbaar-gebied=6.42225,52.1184,6.46705,52.13297
    //https://wegkenmerken.ndw.nu/kaart?kaartlagen=DRIVING_DIRECTION_OVERLAY,ROAD_SECTION_ID_LABEL,HECTOMETRE_SIGN,HOUSE_NUMBER,ADMINISTRATIVE_DIVISION,NDW,SPEED_LIMIT,TRAFFIC_SIGN&zichtbaar-gebied=6.31125,52.10806,6.50667,52.17158
    const coords = getMapCoordinates();
    const zoom = getMapZoomlevel();
    let latMin = coords.y - 0.015 * (5 / zoom);
    let latMax = coords.y + 0.015 * (5 / zoom);
    let lonMin = coords.x - 0.015 * (5 / zoom);
    let lonMax = coords.x + 0.015 * (5 / zoom);
    const url = `https://wegkenmerken.ndw.nu/kaart?kaartlagen=DRIVING_DIRECTION_OVERLAY,ROAD_SECTION_ID_LABEL,HECTOMETRE_SIGN,HOUSE_NUMBER,ADMINISTRATIVE_DIVISION,NDW,SPEED_LIMIT,TRAFFIC_SIGN&zichtbaar-gebied=${lonMin},${latMin},${lonMax},${latMax}`;
    window.open(url, '_blank');
}
function gotoNDW() {
    const coords = getMapCoordinates();
    const url = `https://www.arcgis.com/apps/instant/interactivelegend/index.html?appid=d9382ea7bf574c4ba2d5a740469c504f&center=${coords.x},${coords.y}`;
    window.open(url, '_blank');
}
function gotoGoogleMaps() {
    const coords = getMapCoordinates();
    const zoom = getMapZoomlevel();
    const url = `https://www.google.com/maps/@${coords.y},${coords.x},${zoom}z`;
    window.open(url, '_blank');
}
function gotoMatrixNL() {
    const coords = getMapCoordinates();
    const zoom = getMapZoomlevel();
    const url = `https://matrixnl.nl/index.php?center=${coords.y},${coords.x}&zoom=${zoom}`;
    window.open(url, '_blank');
}
window.SDK_INITIALIZED.then(WMEML_InitScript);
//# sourceMappingURL=wme-maplinks.js.map
})();
//# sourceMappingURL=wme-maplinks.js.map