sneedex tooltips

tooltips to tell you what the colors mean on sneedex.

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     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);
};