Nexus Clash Faction Census

Keeps a tally of faction members

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Nexus Clash Faction Census
// @namespace   Kandarin
// @description Keeps a tally of faction members
// @include	http://www.nexusclash.com/modules.php?*&do=roster
// @include	www.nexusclash.com/modules.php?*&do=roster
// @version 0.0.1.20140922031150
// ==/UserScript==

//checks which ranks a faction contains
//sums number of members of each rank

if (document.body.innerHTML.search('>Leader<')>(-1)) {var Leader = document.body.innerHTML.match(/>Leader</g).length} else {var Leader = 0}
if (document.body.innerHTML.search('>Lieutenant<')>(-1)) {var Lieutenant = document.body.innerHTML.match(/>Lieutenant</g).length} else {var Lieutenant = 0}
if (document.body.innerHTML.search('>Veteran<')>(-1)) {var Veteran = document.body.innerHTML.match(/>Veteran</g).length} else {var Veteran = 0}
if (document.body.innerHTML.search('>Initiate<')>(-1)) {var Initiate = document.body.innerHTML.match(/>Initiate</g).length} else {var Initiate = 0}

var census = Leader + Lieutenant + Veteran + Initiate

//Grammatical adjustment for factions with one character
//Changes character list header to include member tally

if (census!=1)
{
var Census = census + " characters"
document.body.innerHTML = document.body.innerHTML.replace("open faction</td>"," open faction with " + Census + "</td>")
document.body.innerHTML = document.body.innerHTML.replace("closed faction</td>"," closed faction with " + Census + "</td>")
}
else
{
document.body.innerHTML = document.body.innerHTML.replace("open faction</td>"," open faction with 1 character</td>")
document.body.innerHTML = document.body.innerHTML.replace("closed faction</td>"," closed faction with 1 character</td>")
}