GreasyFork Script Numbers figuccio

Aggiunge numeri accanto agli script GreasyFork nelle pagine utente.

Stan na 15-02-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name           GreasyFork Script Numbers figuccio
// @namespace      https://greatest.deepsurf.us/users/237458
// @version        0.1
// @description    Aggiunge numeri accanto agli script GreasyFork nelle pagine utente.
// @author         figuccio
// @match          *://greatest.deepsurf.us/*/users/*
// @match          https://greatest.deepsurf.us/*
// @match          https://sleazyfork.org/*
// @license        MIT
// ==/UserScript==
(function() {
    'use strict';

    function addNumbersToScriptList(selector) {
        const scriptList = document.querySelectorAll(selector);

        if (scriptList) {
            scriptList.forEach((script, index) => {
                // Controllare se esiste già un intervallo di numeri per evitare duplicati
                if (!script.querySelector('.script-number')) { // Aggiunto controllo qui
                    const numberSpan = document.createElement('span');
                    numberSpan.classList.add('script-number'); // Aggiungi una classe per una facile selezione in seguito
                    numberSpan.style.marginRight = '5px';
                    numberSpan.style.fontWeight = 'bold';
                    numberSpan.style.background = 'red';
                    numberSpan.style.color = 'green';
                    numberSpan.textContent = `${index + 1}`;

                    script.insertBefore(numberSpan, script.firstChild);
                }
            });
        }
    }

    // Chiama la funzione per le pagine utente e gli elenchi di script regolari
    addNumbersToScriptList('.script-list > li'); // Pagine utente

   // Per l'elenco degli script principali sulla homepage di GreasyFork/SleazyFork/risultati di ricerca ecc.
// Probabilmente dovrai adattare questo selettore in base alla struttura HTML effettiva.
// Esamina l'HTML della pagina per trovare il selettore corretto. Questo è uno comune:
    addNumbersToScriptList('.script-list-container > ul > li'); //Ad esempio, ADATTARE IN BASE ALLE NECESSITÀ!
    addNumbersToScriptList('.script-list > li'); //Ad esempio, ADATTARE IN BASE ALLE NECESSITÀ!


})();