sneedex tooltips

tooltips to tell you what the colors mean on sneedex.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name     sneedex tooltips
// @version  1
// @grant    none
// @match https://*.sneedex.moe/*
// @description tooltips to tell you what the colors mean on sneedex.
// @namespace https://greasyfork.org/users/981420
// ==/UserScript==
var oldHref = document.location.href;

window.onload = function() {
    var bodyList = document.querySelector("body")
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (oldHref != document.location.href) {
                oldHref = document.location.href;
                //console.log("CHANGED");
                for (const label of document.querySelectorAll("label")) {
                    switch (label.className) {
                        case "bad":
                            label.title = "Bad Encode";
                            break;
                        case "bain":
                            label.title = "Bad Encode and Incomplete";
                            break;
                        case "unmuxed":
                            label.title = "Unmuxed";
                            break;
                        case "unba":
                            label.title = "Bad Encode and Unmuxed";
                            break;
                        case "incomplete":
                            label.title = "Incomplete";
                            break;
                        case "unin":
                            label.title = "Unmuxed and Incomplete";
                            break;
                        default:
                            label.title = "Normal";
                            break;
                    }
                }
                console.log("done adding tooltips");
            }
        });
    });

    var config = {
        childList: true,
        subtree: true
    };

    observer.observe(bodyList, config);
};