sentinel sat

Adds a green "senti" button next to the Partnerhub report button without overlapping.

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

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

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name            sentinel sat
// @description     Adds a green "senti" button next to the Partnerhub report button without overlapping.
// @namespace       https://greasyfork.org/en/users/715686-aseele-h
// @version         2026.02.17.7
// @author          aseele
// @include         https://www.waze.com/editor*
// @include         https://www.waze.com/*/editor*
// @include         https://beta.waze.com/editor*
// @include         https://beta.waze.com/*/editor*
// @grant           none
// @run-at          document-end
// ==/UserScript==

(function() {
    'use strict';

    function toWGS84(x, y) {
        var lon = (x * 180) / 20037508.34;
        var lat = (Math.atan(Math.exp((y * Math.PI) / 20037508.34)) * 360) / Math.PI - 90;
        return { lon: lon.toFixed(6), lat: lat.toFixed(6) };
    }

    function generateURL() {
        var zoom = W.map.getZoom();
        var center = W.map.getCenter();
        var coords = toWGS84(center.lon, center.lat);
        return `https://livingatlas.arcgis.com/sentinel2explorer/#mapCenter=${coords.lon}%2C${coords.lat}%2C${zoom}`;
    }

    function init_SENTI_TOOL() {
        if (typeof W === 'undefined' || !W.map || !W.map.getCenter) {
            setTimeout(init_SENTI_TOOL, 500);
            return;
        }

        // Target the WME permalink group
        var toolbarWrap = document.querySelector('.WazeControlPermalink');

        if (toolbarWrap !== null) {
            // Check if THIS specific button already exists to prevent duplicates
            if (document.getElementById("btn-senti")) return;

            var container = document.createElement('div');
            container.id = "WME_PH_SENTI_CONTAINER";
            container.style.display = "inline-block";
            container.style.marginLeft = "10px"; // Spacing to separate it from the Purple button
            container.style.verticalAlign = "middle";

            container.innerHTML = `
                <a href="#" id="btn-senti" style="
                    display: flex;
                    align-items: center;
                    background-color: #33cc33;
                    color: white;
                    padding: 5px 14px;
                    border-radius: 20px;
                    text-decoration: none;
                    font-family: 'Rubik', sans-serif;
                    font-weight: 500;
                    font-size: 13px;
                    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
                    transition: none;
                ">
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" style="margin-right: 7px;">
                        <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
                        <circle cx="12" cy="10" r="3"></circle>
                    </svg>
                    senti
                </a>
            `;

            // We use 'after' but because the IDs are different, they will stack side-by-side
            toolbarWrap.parentNode.appendChild(container);

            var btn = document.getElementById("btn-senti");

            // Static green - no hover effects as requested
            btn.addEventListener("click", function(e) {
                e.preventDefault();
                window.open(generateURL(), "_blank");
            }, false);

            console.info('Senti Button: Positioned next to Report button');
        } else {
            setTimeout(init_SENTI_TOOL, 1000);
        }
    }

    init_SENTI_TOOL();
})();