sentinel sat

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

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