RadioGoose Stations menu

Affiche les noms des stations en permanence

// ==UserScript==
// @name         RadioGoose Stations menu
// @namespace    rgenchantement
// @version      1.0
// @description  Affiche les noms des stations en permanence
// @author       smogo
// @match        https://radiogoose.ru/play/*
// @icon         https://radiogoose.ru/favicon.ico
// @grant        GM_addStyle
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    // Styles inchangés
    GM_addStyle(`
        .radio-goose-stations {
            position: fixed;
            left: 20px;
            bottom: 20px;
            z-index: 9999;
            max-width: 300px;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            border: 1px solid #ff4500;
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 0 20px rgba(255, 69, 0, 0.3);
        }
        .stations-title {
            color: #ff4500;
            font-size: 1.2em;
            margin-bottom: 10px;
            text-align: center;
        }
        .stations-list {
            display: grid;
            gap: 8px;
            max-height: 60vh;
            overflow-y: auto;
        }
        .station-item {
            padding: 10px;
            background: transparent !important;
            border: 1px solid #ff450033 !important;
            color: #fff !important;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: left;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .station-item:hover {
            border-color: #ff4500 !important;
            background: rgba(255, 69, 0, 0.1) !important;
        }
      .radio-goose-stations {
            position: fixed;
            left: 20px;
            bottom: 20px;
            z-index: 9999;
            max-width: 300px;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            border: 1px solid #ff4500;
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 0 20px rgba(255, 69, 0, 0.3);
        }
        .votre-selec-teur-collapse {
            display: none !important;
        }
    `);

    // Dictionnaire de traduction/noms personnalisés
    const stationNamesMap = {
        "ГУСЬ.Радио": "Goose Radio",
        "ГУСЬ.Бигрум": "Goose Bigroom",
        "ГУСЬ.Рус": "Goose Rus",
        "ГУСЬ.Олдскул": "Goose Oldschool",
        "ГУСЬ.Рок": "Goose Rock",
        "ГУСЬ.Фонк": "Goose Funk",
        "ГУСЬ.Электро": "Goose Electro",
        "ГУСЬ.Дипхаус": "Goose Deep House",
        "ГУСЬ.Технорейв": "Goose Techno",
        "ГУСЬ.Хардстайл": "Goose Hardstyle",
        "ГУСЬ.Мидтемпо": "Goose Midtempo",
        "ГУСЬ.Драм": "Goose Drum",
        "ГУСЬ.Транс": "Goose Trance",
        "ГУСЬ.Денскор": "Goose Denscore",
        "MOSCOW MADNESS (ex. ГУСЬ.Хардкор)": "Moscow Madness"
    };

    function createStationList() {
        const container = document.createElement('div');
        container.className = 'radio-goose-stations';
        container.innerHTML = `
            <div class="stations-title">🎵 Stations Disponibles</div>
            <div class="stations-list"></div>
        `;
        document.body.appendChild(container);
        return container;
    }

    function getStationNames() {
        // Extraction depuis la méta-description
        const metaDesc = document.querySelector('meta[name="description"]');
        if (!metaDesc) return [];

        const rawText = metaDesc.content.split('содержит: ')[1] || '';
        const rawStations = rawText.split(', ').map(s => s.trim());

        // Remplace les noms via le dictionnaire
        return rawStations.map(name => stationNamesMap[name] || name);
    }

    function populateStations(container) {
        const stationsList = container.querySelector('.stations-list');
        const stationNames = getStationNames();

        // Cible uniquement les boutons avec data-hash (évite les éléments non station)
        const originalButtons = Array.from(document.querySelectorAll('#offcanvas-stations [data-hash]'));

        stationNames.forEach((name, index) => {
            const button = document.createElement('button');
            button.className = 'station-item';
            button.textContent = name;

            // Simule un clic sur le bouton original correspondant
            button.addEventListener('click', () => {
                setTimeout(() => {
                    if (originalButtons[index]) originalButtons[index].click();
                }, 500);
            });

            stationsList.appendChild(button);
        });
    }

    // Initialisation avec délai pour s'assurer que le DOM est chargé
    setTimeout(() => {
        const container = createStationList();
        populateStations(container);
    }, 3000); // Ajustez ce délai si nécessaire
})();