Nexus Clash: Lore Counter

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

目前為 2014-08-12 提交的版本,檢視 最新版本

// ==UserScript==
// @name       Nexus Clash: Lore Counter
// @namespace  http://nexusclash.com/wiki/index.php/user:xensyria
// @version    1.0
// @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*
// @copyright  PD
// ==/UserScript==

var sideBars = document.getElementsByName('sidebar');

for (var i = 0; i < sideBars.length; i++){
    
    if (sideBars[i].value == 'Lore'){
        var possibleLore = sideBars[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.textContent
        if (possibleLore.match(/^(\n\s*\d{1,2}\.\s*[a-z ,\?\-:\.\;]+)+\s*$/i)){
            sideBars[i].nextSibling.value = 'Lore (' + possibleLore.match(/\n\s*\d{1,2}\.\s*[A-Za-z ,\?\-:\.\;]+/g).length + '/50)';
        }
    }
    
}