DungeonsOfTheWell profile page: return the `Class levels` option in the menu

Adds a link to the page with id=621 in the drop-down list of the "Journal" menu item on the profile page of the game "Dungeons of the Well"

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name            DungeonsOfTheWell profile page: return the `Class levels` option in the menu
// @name:ru         Возвращение ссылки на страницу "Уровни классов" на странице профиля игры "Подземелья колодца"
// @namespace       http://tampermonkey.net/
// @version         2025-08-03
// @description     Adds a link to the page with id=621 in the drop-down list of the "Journal" menu item on the profile page of the game "Dungeons of the Well"
// @description:ru  Добавляет ссылку на страницу с id=621 в выпадающем списке пункта меню "Журнал" на странице профиля игры "Подземелья колодца"
// @author          rick_headle
// @match           https://vip3well.activeusers.ru/app.php*
// @match           https://welldungeon.online/*
// @icon            none
// @grant           none
// @license         MIT
// ==/UserScript==

// Get the first link in the list
const existingLinkElement = document.querySelector("#m_page a");
if (existingLinkElement) {
    const existingLink = existingLinkElement.href;

    // Modify the existing link to have id=621
    const newLink = existingLink.replace(/id=\d+/, "id=621");

    // Create a new list item with the modified link and title
    const newListElement = document.createElement("li");
    newListElement.innerHTML = `
        <a href="${newLink}" title="Уровни классов" role="menuitem">
            <i class="fa fa-bars"></i>
            <span class=""> Уровни классов</span>
        </a>
    `;

    // Append the new list item to the existing list
    document.querySelector("#m_page").parentNode.appendChild(newListElement);
} else {
    console.log("No link found in the list.");
}