sentinel sat

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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();
})();