Dislevtor

CHUNITHM-NET上のレコードページのランプ部分に、ゲージや達成率を表示します。

Stan na 04-05-2024. Zobacz najnowsza wersja.

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

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

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            Dislevtor
// @name:en         Dislevtor
// @namespace       https://qmainconts.dev/
// @version         1.0.0
// @description     CHUNITHM-NET上のレコードページのランプ部分に、ゲージや達成率を表示します。
// @description:en  Displays gauge and achievement rate in the lamp part of the record page on CHUNITHM-NET.
// @author          Kjuman Enobikto
// @match           https://new.chunithm-net.com/chuni-mobile/html/mobile/record/music*/*
// @match           https://new.chunithm-net.com/chuni-mobile/html/mobile/record/worldsEndList/
// @icon            https://www.google.com/s2/favicons?sz=64&domain=chunithm-net.com
// @grant           none
// @license         MIT
// ==/UserScript==


var intervalID = 0;
var retryCount = 0;

function findScoreListBlock() {
    "use strict";

    const scoreListBlock = document.querySelector(".score_list_block");
    retryCount++;
    if (retryCount > 100) {
        console.info("[Dislevtor] WEnhancer not found.");
        clearInterval(intervalID);
        return;
    }
    if (scoreListBlock) {
        clearInterval(intervalID);
        main();
    }
}

function main() {
    "use strict";

    const scoreListBlock = document.querySelector(".score_list_block");
    if (!scoreListBlock) return;
    const scoreListAll = scoreListBlock.querySelectorAll(".score_list");

    const scoreData = [[], [], []];
    let scoreDataOffset = 0;
    const scoreDataOffsetCounts = [5, 6, 5];
    let scoreOffset = 0;
    for (let i = 0; i < scoreListAll.length; i++) {
        const scoreList = scoreListAll[i];
        scoreList.style.height = "auto";

        const scoreListBottom = scoreList.querySelector(".score_list_bottom");
        scoreListBottom.style.height = "auto";
        const numerator = parseInt(scoreListBottom.querySelector(".score_num_text").innerText);
        const denominator = parseInt(scoreListBottom.querySelector(".score_all_text").innerText.replace("/", "").replace(",", ""));
        const percentage = numerator / denominator * 100;

        const scoreListPercentage = document.createElement("div");
        scoreListPercentage.className = "font_small";
        scoreListPercentage.innerText = percentage.toFixed(2) + "%";
        scoreListBottom.appendChild(scoreListPercentage);

        scoreList.style.background = "linear-gradient(90deg, #ff8888 " + percentage + "%, #ffffee " + percentage + "%)"

        if (scoreList.querySelector("img").src.includes("fullchain")) continue;
        scoreData[scoreDataOffset].push({ num: numerator, den: denominator, per: percentage });

        scoreOffset++;
        if (scoreOffset >= scoreDataOffsetCounts[scoreDataOffset]) {
            scoreDataOffset++;
            scoreOffset = 0;
        }
    }
}

(function () {
    if (location.href === "https://new.chunithm-net.com/chuni-mobile/html/mobile/record/worldsEndList/") {
        intervalID = setInterval(findScoreListBlock, 50);
    } else {
        main();
    }
})();