GreasyFork Script Numbers figuccio

Aggiunge numeri accanto agli script GreasyFork nelle pagine utente.

Ekde 2025/02/15. Vidu La ĝisdata versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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À!


})();