/ ‘grepolis.user.js’
This commit is contained in:
parent
a14912143a
commit
f5f5cdc4f6
@ -20,17 +20,9 @@
|
||||
lastAmounts = "";
|
||||
console.log("Initializing...");
|
||||
windows = {};
|
||||
durations = {};
|
||||
//farm_ids = [1225, 1226, 1228, 1229, 1230, 1231];
|
||||
farm_ids = [20466, 20472, 20471];
|
||||
farm_ids.forEach(function(xFarmId) {
|
||||
console.log("Setting timer to 5s for Farm " + xFarmId);
|
||||
setTimeout(getWaresTick(xFarmId), 5000 + rand(5));
|
||||
});
|
||||
|
||||
window.onclose = function() {
|
||||
alert("test");
|
||||
|
||||
};
|
||||
|
||||
var logWindow = new GPWindow(-1, null);
|
||||
logWindow.createWindow();
|
||||
@ -49,6 +41,13 @@
|
||||
});
|
||||
logWindowElement.empty();
|
||||
|
||||
farm_ids.forEach(function(xFarmId) {
|
||||
var tmout = 5000 + rand(5);
|
||||
setTimeout(getWaresTick(xFarmId), tmout);
|
||||
var tmoutId = 'farm-' + xFarmId
|
||||
logWindowElement.append('<span id="' + tmoutId + '"><script>countdown(' + Math.floor(tmout/10) + ', "' + tmoutId + '");</script></span><br />');
|
||||
})
|
||||
|
||||
$("#ui-id-1").empty().append("<select id=choosefarmduration><option value=300>5min</option><option value=1200>20min</option><option value=5400>90min</option><option value=14400>4h</option></select>");
|
||||
var choose = $("#choosefarmduration")[0];
|
||||
choose.onchange = function() {
|
||||
@ -138,6 +137,7 @@
|
||||
|
||||
getWaresFromFarm(wnd, mood, xFarmId);
|
||||
} finally {
|
||||
durations[xFarmId] = timeout / 1000;
|
||||
setTimeout(getWaresTick(xFarmId), timeout);
|
||||
}
|
||||
}
|
||||
@ -156,4 +156,21 @@
|
||||
function buttonIsInitialized() {
|
||||
return typeof(btn) != "undefined" && btn != null && btn[0] != null;
|
||||
}
|
||||
|
||||
function countdown(time, id){
|
||||
t = time;
|
||||
|
||||
h = Math.floor(t/(60*60)) % 24;
|
||||
m = Math.floor(t/60) %60;
|
||||
s = t %60;
|
||||
|
||||
h = (h < 10) ? "0"+h : h;
|
||||
m = (m < 10) ? "0"+m : m;
|
||||
s = (s < 10) ? "0"+s : s;
|
||||
|
||||
strZeit = h + ":" + m + ":" + s;
|
||||
|
||||
window.setTimeout('countdown('+ --time+',\''+id+'\')',1000);
|
||||
document.getElementById(id).innerHTML = strZeit;
|
||||
}
|
||||
})()
|
Loading…
x
Reference in New Issue
Block a user