There are 13 previous versions of this script.
Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)
// Simple translation updates by Whiskers, plus font size change. Whiskers takes NO CREDITS towards this script, this is just a simple comment.
//
// version 1.4.2 (lite)
// 2008-05-21
// author - immortalnights
// contributions by - wphilipw and ecamanaut
//
// homepage - http://www.ikaraimlibrary.com/
// for up to date details and version, please check the home page.
//
// Please do not remove the above details; it is impossible to ensure
// all copys of this script are kept upto date, people need to know
// where they can go to get the most up to date version.
//
// For full version history please see, http://www.ikariamlibrary.com/
//
// ==UserScript==
// @name Puntuaciones para Troyanos
// @namespace ikariamScript
// @description informa de las puntuaciones de los jugadores.
// @include http://*.ikariam.*/*
// @exclude http://board.ikariam.*/*
// ==/UserScript==
var baseDivCreated = false;
var gameServer = top.location.host;
var gameServerParts = gameServer.split(".");
var subDomain = gameServerParts[1];
var domain = gameServerParts[2];
var post = {
score: "score",
military: "army_score_main",
gold: "trader_score_secondary" };
var updateCounter =0;
var scoreTypes = {
0: "score",
1: "military",
2: "gold",
3: "allyscore"};
var scoreShown = false;
getElementsByClass = function(inElement, className, findIn) {
var all = inElement.getElementsByTagName('*');
var elements = [];
for (var e = 0; e < all.length; e++) {
if (findIn == true) {
if (all[e].className.indexOf(className) > 0) {
elements[elements.length] = all[e];
}
} else {
if (all[e].className == className) {
elements[elements.length] = all[e];
}
}
}
return elements;
};
// called using player name, score type,
function requestScore(playerName, type, onload) {
GM_xmlhttpRequest({
method:'POST',
url:'http://' + gameServer + '/index.php',
data:"view=highscore&highscoreType=" + post[type] + "&searchUser=" + playerName,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'application/atom+xml,application/xml,text/xml',
'Referer': 'http://' + gameServer + '/index.php',
'Cookie': document.cookie
},
onload:onload
});
}
function requestAlliance(allyId, onload) {
GM_xmlhttpRequest({
method:'POST',
url:'http://' + gameServer + '/index.php',
data:"view=allyPage&allyId=" + allyId,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'application/atom+xml,application/xml,text/xml',
'Referer': 'http://' + gameServer + '/index.php',
'Cookie': document.cookie
},
onload:onload
});
}
function fmtNumber(n) {
n += "";
for (var i = (n.length - 3); i > 0; i -= 3) {
n = n.slice(0, i) +","+ n.slice(i);
}
return n;
}
function createBaseDiv() {
baseDivCreated = true;
scoreElement = document.createElement("div");
scoreElement.setAttribute("id", "inlinescore");
var scoreDiv = <>
<li style="margin: 2px 10px;font-size:10px" id="total_score" class="ally">
<span style="float:left;" class="textLabel">{lang['score']}:</span>
<div id="score">{lang['unknown']}</div>
</li>
<li style="margin: 2px 10px;font-size:10px" id="army_score_main" class="ally">
<span style="float:left;" class="textLabel">{lang['military']}:</span>
<div id="military">{lang['unknown']}</div>
</li>
<li style="margin: 2px 10px;font-size:10px" id="trader_score_secondary" class="ally">
<span style="float:left;" class="textLabel">{lang['gold']}:</span>
<div id="gold">{lang['unknown']}</div>
</li>
<li style="margin: 2px 10px;font-size:10px" id="ally_members" class="ally">
<span style="float:left;" class="textLabel">{lang['allyscore']}:</span>
<div id="allyscore">{lang['unknown']}</div>
</li>
</>;
scoreElement.innerHTML = scoreDiv;
// get container for Island view
var informationContainer = document.getElementById('infocontainer');
if (!informationContainer) {
informationContainer = document.getElementById('information');
}
var allyClass = getElementsByClass(informationContainer, "ally")
insertAfter(scoreElement, allyClass[0]);
scoreShown = true;
}
function insertAfter(newElement,targetElement) {
//target is what you want it to go after. Look for this elements parent.
var parent = targetElement.parentNode;
//if the parents lastchild is the targetElement...
if(parent.lastchild == targetElement) {
//add the newElement after the target element.
parent.appendChild(newElement);
} else {
// else the target has siblings, insert the new element between the target and it's next sibling.
parent.insertBefore(newElement, targetElement.nextSibling);
}
}
function updateScore(type, score) {
document.getElementById(type).innerHTML = score;
}
function updateDetails(type, playerName, townLevel, responseText) {
var hiddenDiv = document.createElement("div");
hiddenDiv.setAttribute("style", "display: hidden;");
document.body.appendChild(hiddenDiv);
hiddenDiv.innerHTML = responseText;
var score = getElementsByClass(hiddenDiv, "score", false);
var pname = getElementsByClass(hiddenDiv, "name", false);
for (var e = 0; e < pname.length; e++) {
if (pname[e].innerHTML == playerName) {
var totalScore = score[e].innerHTML;
}
}
document.body.removeChild(hiddenDiv);
if (type == "gold") {
if (totalScore) {
if (totalScore.indexOf(",") != -1) {
gold = parseInt(totalScore.replace(/,/g, ""),10);
} else {
gold = parseInt(totalScore.replace(/[.]/g, ""),10);
}
lootable = Math.round(townLevel * (townLevel - 1) / 10000 * gold);
totalScore += " (" + fmtNumber(lootable) + ")";
} else {
totalScore = "0";
}
}
GM_setValue(type, totalScore);
document.getElementById(type).innerHTML = totalScore;
}
function updateAllyDetails(divId, responseText) {
var hiddenDiv = document.createElement("div");
hiddenDiv.setAttribute("style", "display: none;");
document.body.appendChild(hiddenDiv);
hiddenDiv.innerHTML = responseText;
var allyTable = getElementsByClass(hiddenDiv, 'content', false);
var members = parseInt(allyTable[1].childNodes[1].childNodes[1].childNodes[2].childNodes[2].innerHTML, 10);
var posScore = allyTable[1].childNodes[1].childNodes[1].childNodes[6].childNodes[2].innerHTML;
posScore = posScore.split("(")[1];
posScore = posScore.split(")")[0];
document.body.removeChild(hiddenDiv);
GM_setValue(divId, (posScore + " (" + members + ")"));
document.getElementById(divId).innerHTML = (posScore + " (" + members + ")");
}
function cityInformation() {
if (!document.getElementById("inlinescore")) {
createBaseDiv();
}
// Get the lanugage
lang = defineLanguage(domain);
var playerScore = -1;
// Remove the "points" information (as of 0.2.8), and get the value for later
var infoContainer = document.getElementById("infocontainer");
if (infoContainer) {
var pointsLi = getElementsByClass(infoContainer, "name", false);
if (pointsLi[1]) {
playerScore = parseInt(pointsLi[1].innerHTML.split(/>/)[2].replace(/,/g, ""),10);
pointsLi[1].style.display = "none";
}
}
// Remove the disabled actions... looks messy when it happens
var actions = document.getElementById("actions");
if (actions) {
textSpans = getElementsByClass(actions, "disabled", true);
for (var cnt = 0; cnt < textSpans.length;cnt++) {
//textSpans[cnt].style.display = "none";
}
}
// Removes the report player link, again causes a fliker
var reportPlayer = getElementsByClass(document, "reportPlayer");
//reportPlayer[0].style.display = "none";
updateScore("score", lang.fetch); updateScore("military", lang.fetch); updateScore("gold", lang.fetch); updateScore("allyscore", lang.fetch);
var listParts = "";
// Get the players name
listParts = getElementsByClass(document,"owner", false)[0].innerHTML.split(">");
listParts[2] = listParts[2].split("<")[0];
var playerName = listParts[2].replace(/^\s+|\s+$/g, ''); // trim up the Player Name// get the players name
playerName = playerName.replace(/ /g, " "); // replace any silly nubspaces!
// Get the players town level for gold pillage data
listParts = getElementsByClass(document,"citylevel", false)[0].innerHTML.split(">");
listParts[2] = listParts[2].split("<")[0];
var townLevel = parseInt(listParts[2].replace(/^\s+|\s+$/g, ''), 10); // trim up the town level
// Get the players alliance id for alliance check
listParts = getElementsByClass(document,"ally", false)[0].innerHTML.split(">");
if (listParts.length == 5 || listParts.length == 8) {
listParts = listParts[2].split("&")[1];
var allyId = parseInt(listParts.split("=")[1].replace(/^\s+|\s+$/g, ''), 10); // trim up the ally id
} else {
var allyId = -1;
GM_setValue("allyscore", "-");
}
var checkedTime = (new Date().getTime() - (1000*60*10));
if (playerName != GM_getValue("lastPlayerCheck") || GM_getValue("lastCheckedTimestamp") < checkedTime || GM_getValue("lastServerCheck") != gameServer) {
if (playerScore > -1) {
updateScore('score', fmtNumber(playerScore));
} else {
requestScore(playerName, 'score', function(responseDetails) {
updateDetails('score', playerName, townLevel, responseDetails.responseText);
});
}
requestScore(playerName, 'military', function(responseDetails) {
updateDetails('military', playerName, townLevel, responseDetails.responseText);
});
requestScore(playerName, 'gold', function(responseDetails) {
updateDetails('gold', playerName, townLevel, responseDetails.responseText);
});
if (allyId != -1) {
requestAlliance(allyId, function(responseDetails) {
updateAllyDetails('allyscore', responseDetails.responseText);
});
} else {
updateScore("allyscore", "-")
document.getElementById('ally_members').style.display = "none";
}
GM_setValue("lastCheckedTimestamp", new Date().getTime() + "");
GM_setValue("lastPlayerCheck", playerName);
GM_setValue("lastServerCheck", gameServer);
} else {
for (var interation = 0;interation < 4; interation++) {
var type = scoreTypes[interation];
if (type == "allyscore" && GM_getValue(type) == "-") {
document.getElementById(type).innerHTML = GM_getValue(type);
document.getElementById('ally_members').style.display = "none";
} else {
document.getElementById(type).innerHTML = GM_getValue(type);
}
}
}
}
function defineLanguage(langTDL) {
switch (langTDL) {
case "fr":
language = { inline:"Inline Score",
fetch:"cargando...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Points",
military:"Troupes",
gold:"Oro" };
break;
case "gr":
language = { inline:"Inline Score",
fetch:"ανάκτηση...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Βαθμολογία",
military:"Στρατεύματα",
gold:"Χρυσός" };
break;
case "de":
language = { inline:"Inline Score",
fetch:"Laden...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Gesamtpunkte",
military:"Generäle",
gold:"Goldbestand" }
break;
case "tr":
language = { inline:"Inline Score",
fetch:"Yukleniyor...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Toplam Puan",
military:"Askeri Puan",
gold:"Altin Puani" };
break;
case "cz":
language = { inline:"Inline Score",
fetch: "nahrávam...",
unknown:"Unknown",
allyscore:"Ally Score",
score: "Celkové skóre",
military: "Vojenské skóre",
gold: "Zlatá zásoba" };
break;
case "sk":
language = { inline:"Inline Score",
fetch:"nahrávam...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Celkové Skóre",
military:"Vojenské skóre",
gold:"Zlatá zásoba" };
break;
case "tw":
language = { inline:"分數顯示",
fetch:"讀取中...喵喵喵",
unknown:"Unknown",
allyscore:"聯盟分數",
score:"總積分",
military:"戰爭將軍",
gold:"黃金存量" };
break;
case "hu":
language = { inline:"Inline Score",
fetch:"Töltés...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Összpontszám",
military:"Katonai pont",
gold:"Arany" };
break;
case "se":
language = { inline:"Inline Score",
fetch:"hämtar...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Totalpoäng",
military:"Generalspoäng",
gold:"Guldmängd" }
break;
case "pl":
language = { inline:"Inline Score",
fetch:"Ładowanie...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Całkowity Wynik",
military:"Generałowie",
gold:"Zapas Złota" };
break;
case "ro":
language = { inline:"Inline Score",
fetch:"Incarc...",
unknown:"Necunoscut",
allyscore:"Scor Alianta",
score:"Scor Total",
military:"Scor Armata",
gold:"Scor Aur" };
break;
case "il":
language = { inline:"Inline Score",
fetch:"טוען...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"ניקוד",
military:"כח צבאי",
gold:"זהב" };
break;
case "ikariam":
if (subDomain == "fi") {
language = { inline:"Inline Score",
fetch:"haetaan...",
unknown:"Unknown",
allyscore:"Ally Score",
score:"Kokonaispisteet",
military:"Sotilaspisteet",
gold:"Kulta" };
}
if (subDomain == "ae") {
language = { inline:"Inline Score",
fetch:"يجلب...",
unknown:"Unknown",
allyscore:"نقاط التحالف",
score:"المجموع الكلي",
military:"النقاط العسكريه",
gold:"الذهب" };
}
if (subDomain == "ba") {
language = { inline:"Inline Score",
fetch:"dohvati...",
unknown:"nemoguce",
allyscore:"Bodovi Saveza",
score:"Ukupni Rezultat",
military:"Vojska",
gold:"Zlato" };
}
break;
default:
language = { inline:"Inline Score",
fetch:"Fetching...",
unknown:"Unknown",
allyscore:"Puntos Alianza",
score:"Puntos Totales",
military:"P.Militares",
gold:"Oro total" };
break;
}
return language;
}
function init() {
lang = defineLanguage(domain);
var linkElements = document.getElementsByTagName('a');
for (var i = 0; i < linkElements.length; i++) {
if (linkElements[i].id.search(/city_[0-9]*/) != -1) {
linkElements[i].addEventListener('click', function() { window.setTimeout(cityInformation, 1); }, false);
}
}
var informationDiv = document.getElementById('information');
if (informationDiv) {
var listElements = informationDiv.getElementsByTagName('li');
if (listElements.length > 0) {
cityInformation();
}
}
}
init();
// ==UserScript==
// @name ALIANZAS COA`S ALPHA
// @namespace ikatips
// @description Herraminetas para la alianza
// @include http://*ikariam.*/index.php*
// @author Original por Verx - Modificado por ALEX para ALIANZAS COA -
// @version 20080619 120713
// ==/UserScript==
var tagsAModificar = new Array("A","SPAN");
var diaLimite = 2;
var cookieIKO = 'IKAFONT';
var cookie_SEPARA = '|';
var css_MenuIKO_String = '#menu {'+
'align:right;'+
'margin-left:680px;'+
'margin-top: -16.5px;'+
'color:white;'+
'width: 50px;'+
'cursor: hand;'+
'}'+
'#menu ul {'+
'list-style: none;'+
'margin: 0;'+
'padding: 0;'+
'width: 13em;'+
'}'+
'#menu a, #menu h2 {'+
'font: bold 11px/16px arial, helvetica, sans-serif;'+
'display: block;'+
'margin: 0;'+
'padding: 2px 3px;'+
'cursor: hand;'+
'}'+
'#menu a {'+
'color: RGB(84,44,15);'+
//Colores menu normal.
'background: RGB(246,235,188);'+
'border: double 3px RGB(84,44,15);'+
'border-left: double 3px RGB(84,44,15);'+
'border-right: double 3px RGB(84,44,15);'+
'text-decoration: none;'+
'}'+
'#menu a:hover {'+
'color: RGB(84,44,15);'+
//Color menu seleccionado.
'background: RGB(222,180,120);'+
'border: double 3px RGB(84,44,15);'+
'}'+
'#menu li {position: relative; }'+
'#menu ul ul {'+
'position: relative;'+
'z-index: 500;'+
'}'+
'#menu ul ul ul {'+
'position: absolute;'+
'top: 0;'+
'left: 100%;'+
'}'+
'div#menu ul ul,'+
'div#menu ul li:hover ul ul,'+
'div#menu ul ul li:hover ul ul'+
'{display: none;}'+
'div#menu ul li:hover ul,'+
'div#menu ul ul li:hover ul,'+
'div#menu ul ul ul li:hover ul'+
'{display: block;}';
//esta característica es casi estándar, utilizado en muchos scripts de Greasemonkey
if(!window.add_Global_Style){
function add_Global_Style(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
}
function getAlltagsAModificar(){
var arrResult = new Array();
var lastI = 0;
var xTags = null;
for (tagX = 0; tagX<tagsAModificar.length; tagX++) {
xTags = document.getElementsByTagName(tagsAModificar[tagX]);
for(i=0;i<xTags.length;i++){arrResult[lastI] = xTags[i];lastI++;}
}
return arrResult;
}
unsafeWindow.setFontIka = function () {
var FamilyIndex = document.getElementById("Family").selectedIndex;
var FI = document.getElementById("Family").options[FamilyIndex].text;
changeAllFamily(FI);
var SizeIndex = document.getElementById("Size").selectedIndex;
var SI = document.getElementById("Size").options[SizeIndex].text;
changeAllSize(SI);
var ColorIndex = document.getElementById("Color").selectedIndex;
var CI = document.getElementById("Color").options[ColorIndex].text;
changeAllColor(CI);
createCookie(cookieIKO,FI+cookie_SEPARA+SI+cookie_SEPARA+CI,diaLimite);
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(c_name) {
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function initFont(){
var rC = readCookie(cookieIKO);
if (rC){
var myFont = rC.split(cookie_SEPARA);
changeAllFamily(myFont[0]);
changeAllSize(myFont[1]);
changeAllColor(myFont[2]);
}
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
function changeAllFamily(valueOfSelect){
var dataToChange = getAlltagsAModificar();
for (i=0;i<dataToChange.length;i++){
dataToChange[i].style.fontFamily = valueOfSelect;
}
}
function changeAllSize(valueOfSelect){
var dataToChange = getAlltagsAModificar();
for (i=0;i<dataToChange.length;i++){
dataToChange[i].style.fontSize = valueOfSelect;
}
}
function changeAllColor(valueOfSelect){
var dataToChange = getAlltagsAModificar();
for (i=0;i<dataToChange.length;i++){
dataToChange[i].style.color = valueOfSelect;
}
}
unsafeWindow.clearFont = function(){
eraseCookie(cookieIKO);
window.location.reload();
}
function addIKOS_ToolsMenu(){
var xTags = document.getElementsByTagName('LI');
var xLi = null;
var IKOSTools_Link = document.createElement('LI');
IKOSTools_Link.setAttribute('id', 'IKOSTools');
for(i=0;i<xTags.length;i++){
xLi = xTags[i];
if (xLi.className == 'help') {
xLi.parentNode.appendChild(IKOSTools_Link,xLi);
add_Global_Style(css_MenuIKO_String);
document.getElementById('IKOSTools').innerHTML =
'<div id="menu">'
+ '<ul>'
+ ' <li><h2>TROYANOS</h2>'
+ ' <ul>'
+ ' <li><a target="_blank" href="http://troyanosfan.foroactivo.net/index.htm" title="FORO TROYANOS" align="left"> Foro de los troyanos</a></li>'
+ ' <li><a target="_blank" href="http://lacoalicion.foroactivo.com.es/index.htm?sid=b775a7517f4f182ed51d241813b2f8f7" title="Foro de la Hermandad de los troyanos" align="left"> FORO HERMANDAD</a></li>'
+ ' <li><a target="_blank" href="http://troyanosfan.foroactivo.net/portal.htm" title=" Portal oficial con multiples modulos de descarga, busqueda,etc...." align="left"> PORTAL OFICIAL</a></li>'
+ ' <li><a target="_blank" href="http://userscripts.org/users/61979/scripts" title="Sripts de la alianza" align="left"> SCRIPTS DE LA ALIANZA</a></li>'
+ ' <li><a target="_blank" href="http://cuhuutopiascitys.es.tl/" title="WEB ALIANZA" align="left"> WEB ALIANZA</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=sendAllyMessage&oldView=diplomacyAdvisor&watch=4&id=12&type=50" title=" Mensaje a todos " align="left"> Mensaje a todos</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=sendMessage&with=6005&oldView=highscore" title="LIDER TROYANOS" align="left"> LIDER TROYANOS</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=sendMessage&with=79253&oldView=highscore" title="LIDER HERMANDAD DE TROYANOS" align="left"> LIDER HERMANDAD DE TROYANOS</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=sendMessage&with=13449&oldView=highscore" title="LIDER TROY 2" align="left"> LIDER TROY 2</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=sendMessage&with=57566&oldView=highscore" title="LIDER TROY3" align="left"> LIDER TROY3</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=sendMessage&with=5917&oldView=highscore" title="LIDER MEDIT" align="left"> LIDER MEDIT</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=allyPage&allyId=40" title="Pagina externa de la alianza troyanos" align="left"> P.EXTERNA TROYANOS</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=allyPage&allyId=8119" title="Pagina externa de la alianza troyanos2" align="left"> P.EXTERNA TROYANOS2</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=allyPage&allyId=4158" title="Pagina externa de la alianza Hermandad de troyanos" align="left"> P.EXTERNA HERMANDAD</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=allyPage&allyId=8976" title="Pagina externa de la alianza La Diosa Isis Troy3" align="left"> P.EXTERNA TROY3</a></li>'
+ ' <li><a target="_blank" href="http://s1.ikariam.es/index.php?view=allyPage&allyId=8571" title="Pagina externa de la alianza Mediterranea" align="left"> P.EXTERNA MEDIT</a></li>'
+ ' <li><a target="_blank" href="http://www.serpini.es/chivakariam/index.php" title=" Xivaikariam " align="left"> Xivaikariam</a></li>'
+ ' <li><a target="_blank" href="http://troyanosfan.foroactivo.net/tv-radio-programacion-f4/radio-t17.htm" title=" Radio " align="left"> Radio</a></li>'
+ ' <li><a target="_blank" href="http://troyanosfan.foroactivo.net/tv-radio-programacion-f4/television-t16.htm" title=" TELEVISION " align="left"> Television</a></li>'
+'</ul>'
+'</DIV>';
break;
}}}
addIKOS_ToolsMenu();