DungeonsOfTheWell profile page: add info about rune's percentage

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);
})();