By Black Cat
—
Last update
Jan 27, 2008
—
Installed
7,090 times.
// ==UserScript==
// @name OGame : Holding Consumption
// @namespace http://userscripts.org/users/36331
// @description OGame : Holding Consumption
// @date 2008-01-27
// @creator Black Cat
// @include http://uni*.ogame.*/game/index.php?page=flotten3*
// @exclude
// ==/UserScript==
(function(){
var select = document.getElementsByName("holdingtime")[0];
if (!select)
select = document.getElementsByName("expeditiontime")[0];
if (select) {
var cost_per_hour = 0;
for (var i = 200; i < 220; i++) {
var shipcount = document.getElementsByName("ship" + i)[0];
if (shipcount) {
var shipconsumption = document.getElementsByName("consumption" + i)[0];
cost_per_hour += shipcount.value*shipconsumption.value/10;
}
}
select.parentNode.setAttribute("colSpan","2");
var font = document.createElement("font");
font.setAttribute("color","lime");
font.setAttribute("id","total_deut_cost");
var th = document.createElement("th");
th.appendChild(font);
select.parentNode.parentNode.appendChild(th);
var doc = document.getElementsByTagName('form')[0];
var script = document.createElement('script');
script.setAttribute("type","text/javascript");
script.setAttribute("language","javascript");
script.text = "function holdingConsumption(time) { var holdingconsumption = Math.floor(time*" + cost_per_hour + "); if (holdingconsumption == 0) holdingconsumption = 1; document.getElementById('total_deut_cost').innerHTML=tsdpkt(consumption()+holdingconsumption); }";
doc.parentNode.insertBefore(script, doc);
select.setAttribute("onChange","holdingConsumption(this.value);");
if (select.getAttribute("onChange") == null)
select.onchange = function() { holdingConsumption(this.value); };
select.setAttribute("onKeyup","holdingConsumption(this.value);");
if (select.getAttribute("onKeyup") == null)
select.onkeyup = function() { holdingConsumption(this.value); };
var options = select.getElementsByTagName("option");
for (var i = 0; i < options.length; i++) {
options[i].setAttribute("onMouseover","holdingConsumption(this.value);");
}
document.body.setAttribute("onLoad","holdingConsumption(" + document.getElementById('content').getElementsByTagName('select')[0].value + ");");
if (document.body.getAttribute("onLoad") == null)
document.body.onload = function() { holdingConsumption(document.getElementById('content').getElementsByTagName('select')[0].value); }
}
})();