/ ‘grepolis.user.js’

This commit is contained in:
Jan Bader 2014-06-15 00:34:12 +02:00
parent 6888e42417
commit 46efaaa006

View File

@ -10,7 +10,7 @@
// //
// @match http://*.grepolis.com/game/* // @match http://*.grepolis.com/game/*
// //
// @version 1.0.64 // @version 1.0.65
// @updateURL http://git.javil.eu/jan/userscripts/raw/master/grepolis.user.js // @updateURL http://git.javil.eu/jan/userscripts/raw/master/grepolis.user.js
// ==/UserScript== // ==/UserScript==
@ -41,6 +41,13 @@
}); });
logWindowElement.empty(); 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>"); $("#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]; var choose = $("#choosefarmduration")[0];
choose.onchange = function() { choose.onchange = function() {
@ -150,27 +157,25 @@
return typeof(btn) != "undefined" && btn != null && btn[0] != null; return typeof(btn) != "undefined" && btn != null && btn[0] != null;
} }
function countdown(time, id){
t = time;
h = Math.floor(t/(60*60)) % 24; var s = document.createElement("script");
m = Math.floor(t/60) %60; s.type = "text/javascript";
s = t %60; s.innerHTML = '
function countdown(time, id){
t = time;
h = (h < 10) ? "0"+h : h; h = Math.floor(t/(60*60)) % 24;
m = (m < 10) ? "0"+m : m; m = Math.floor(t/60) %60;
s = (s < 10) ? "0"+s : s; s = t %60;
strZeit = h + ":" + m + ":" + s; h = (h < 10) ? "0"+h : h;
m = (m < 10) ? "0"+m : m;
window.setTimeout('countdown('+ --time+',\''+id+'\')',1000); s = (s < 10) ? "0"+s : s;
strZeit = h + ":" + m + ":" + s;
window.setTimeout(\'countdown(\'+ --time+\',\\\'\'+id+\'\\\')\',1000);
document.getElementById(id).innerHTML = strZeit; document.getElementById(id).innerHTML = strZeit;
} }'
document.getElementsByTagName("head")[0].appendChild(s);
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 />');
});
})() })()