Nexus Clash: Lore Counter

Adds total Lore collected so far to the Lore button in the sidebar when Lore is selected.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Nexus Clash: Lore Counter
// @namespace    http://nexusclash.com/wiki/index.php/user:xensyria
// @version      1.2
// @description  Adds total Lore collected so far to the Lore button in the sidebar when Lore is selected.
// @match        http://nexusclash.com/modules.php?name=Game*
// @match        http://www.nexusclash.com/modules.php?name=Game*
// @exclude      http://nexusclash.com/modules.php?name=Game&op=disconnect
// @exclude      http://www.nexusclash.com/modules.php?name=Game&op=disconnect
// @grant        none
// @copyright    PD
// ==/UserScript==

var sideBars = document.getElementsByName('sidebar');    //  Find the sidebar

for (var i = 0; i < sideBars.length; i++){        //  Cycle through the buttons

    if (sideBars[i].value == 'Lore'){      //  Find the Lore button if it's there

        var possibleLore = sideBars[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.textContent   //  Select the sidebar pane from the Lore button

        if (possibleLore.match(/^(\n\s+\d{1,2}\.\s+[a-z ,\?\-:\.\;]+)+\s*$/i)){      //  Check if the pane contents match Lore formatting (e.g. 1. blah / 20. blah / etc.)

            sideBars[i].nextSibling.value = 'Lore (' + possibleLore.match(/\n\s+\d{1,2}\.\s+[a-z ,\?\-:\.\;]+/gi).length + '/50)';   //  If so, change Lore button to include Lore count

        }

    }

}