DungeonsOfTheWell profile page: add info about rune's percentage

Adds rounded up percentage value to the progress bars' text on DungeonsOfTheWell profile page

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            DungeonsOfTheWell profile page: add info about rune's percentage
// @name:ru         Добавление процентного соотношения найденных рун на странице профиля игры "Подземелья колодца"
// @namespace       http://tampermonkey.net/
// @version         2025-08-03
// @description     Adds rounded up percentage value to the progress bars' text on DungeonsOfTheWell profile page
// @description:ru  Добавляет информацию о процентном соотношении найденных рун (с округлением вверх) на странице "Журнал -> Руны усиления" на странице профиля игры "Подземелья колодца"
// @author          You
// @match           https://vip3well.activeusers.ru/app.php?act=pages&id=618*
// @match           https://welldungeon.online/?act=pages&id=618*
// @icon            none
// @grant           none
// @license         MIT
// ==/UserScript==

(function() {
    'use strict';

    function updateProgressBarValue(element) {
        const value = element.innerText.split('/')[0];
        const total = element.innerText.split('/')[1];
        const percentage = Math.round((value / total) * 100);
        element.innerText = `${value}/${total} (${percentage}%)`;
    }

    const progressBars = [
        document.querySelector("#w_376 > div > b > div:nth-child(2) > div"),
        document.querySelector("#w_376 > div > b > div:nth-child(6) > div"),
        document.querySelector("#w_376 > div > b > div:nth-child(11) > div"),
        document.querySelector("#w_376 > div > b > div:nth-child(15) > div"),
        document.querySelector("#w_376 > div > b > div:nth-child(19) > div"),
        document.querySelector("#w_376 > div > b > div:nth-child(24) > div")
    ];

    progressBars.forEach(updateProgressBarValue);
})();