
This is usually not a problem but when a player has 2 cities on the same island and you want to coordinate an alliance attack there can be implications.
I propose expanding town names.
- Code: Select all
// credits for this code goes to Overkill
for each (var cityElem in $x('//ul[@id="cities"]/li[contains(@class,"city level")]')){
var label,temp, name, status = '';
label = $X('.//span[@class="textLabel"]',cityElem);
status = trim(stripHTML(label.innerHTML)).substr(-3);
switch(status) {
case '(i)' :
case '(v)' :
case '(x)' :
status = ' ' + status
break;
default :
status = '';
break;
}
if (temp = $X('./ul[@class="cityinfo"]/li[@class="name"][1]/text()',cityElem))
name = temp.nodeValue;
for (var i = 2,n = label.childNodes.length-2;i<n;++i){
if (label.childNodes[i].innerHTML || (label.childNodes[i].nodeValue && trim(label.childNodes[i].nodeValue))) {
if (label.childNodes[i].innerHTML) { label.childNodes[i].innerHTML = name + status; }
else { label.childNodes[i].nodeValue = name + status; }
break;
}
}
//////////////////
function $x( xpath, root ) { var doc = root ? root.evaluate ? root : root.ownerDocument : document, next; var got = doc.evaluate( xpath, root||doc, null, 0, null ), result = []; switch (got.resultType) { case got.STRING_TYPE: return got.stringValue; case got.NUMBER_TYPE: return got.numberValue; case got.BOOLEAN_TYPE: return got.booleanValue; default: while (next = got.iterateNext()) result.push( next ); return result; } }
function $X( xpath, root ) { var got = $x( xpath, root ); return got instanceof Array ? got[0] : got; }




