diff --git a/grepolis.user.js b/grepolis.user.js index 65e4e63..c1cc2e1 100644 --- a/grepolis.user.js +++ b/grepolis.user.js @@ -10,7 +10,7 @@ // // @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 // ==/UserScript== @@ -41,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('
'); + }); + $("#ui-id-1").empty().append(""); var choose = $("#choosefarmduration")[0]; choose.onchange = function() { @@ -150,27 +157,25 @@ 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; + var s = document.createElement("script"); + s.type = "text/javascript"; + s.innerHTML = ' + function countdown(time, id){ + t = time; - h = (h < 10) ? "0"+h : h; - m = (m < 10) ? "0"+m : m; - s = (s < 10) ? "0"+s : s; + h = Math.floor(t/(60*60)) % 24; + m = Math.floor(t/60) %60; + s = t %60; - strZeit = h + ":" + m + ":" + s; - - window.setTimeout('countdown('+ --time+',\''+id+'\')',1000); + 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; - } - - farm_ids.forEach(function(xFarmId) { - var tmout = 5000 + rand(5); - setTimeout(getWaresTick(xFarmId), tmout); - var tmoutId = 'farm-' + xFarmId - logWindowElement.append('
'); - }); + }' + document.getElementsByTagName("head")[0].appendChild(s); })() \ No newline at end of file