Dislevtor

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

04.05.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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();
    }
})();