/ ‘grepolis.user.js’

This commit is contained in:
Jan Bader 2014-06-04 16:35:16 +02:00
parent 61c271e9ef
commit 47785a1178

View File

@ -10,7 +10,7 @@
// //
// @match http://*.grepolis.com/game/* // @match http://*.grepolis.com/game/*
// //
// @version 1.0.40 // @version 1.0.41
// @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==
@ -60,10 +60,8 @@
var windowId = windows[xFarmId]; var windowId = windows[xFarmId];
if(windowId == undefined){ if(windowId == undefined){
console.log("Opening new Window");
var wnd = GPWindowMgr.Create( var wnd = GPWindowMgr.Create(
GPWindowMgr.TYPE_FARM_TOWN, GPWindowMgr.TYPE_FARM_TOWN, '',
'',
{'action': "claim_info"}, {'action': "claim_info"},
xFarmId); xFarmId);
windows[xFarmId] = wnd.getID(); windows[xFarmId] = wnd.getID();
@ -74,7 +72,6 @@
var wnd = GPWindowMgr.getWindowById(windowId); var wnd = GPWindowMgr.getWindowById(windowId);
if(wnd == undefined){ if(wnd == undefined){
windows[xFarmId] = undefined; windows[xFarmId] = undefined;
console.log("Window not open any more");
timeout = 50; timeout = 50;
return; return;
} }
@ -82,11 +79,9 @@
var wndElement = wnd.getElement(); var wndElement = wnd.getElement();
if(wndElement == undefined){ if(wndElement == undefined){
windows[xFarmId] = undefined; windows[xFarmId] = undefined;
console.log("Window not reachable any more");
try { try {
wnd.close(); wnd.close();
} catch(e) { } catch(e) {
console.warn("Could not close Window");
} }
timeout = 50; timeout = 50;
return; return;
@ -102,7 +97,7 @@
var seconds = minutes * 60 + ts.substring(5,7) * 1; var seconds = minutes * 60 + ts.substring(5,7) * 1;
$('.town_name').text(dformat + " +" + ts); $('.town_name').text(dformat + " +" + ts);
console.log("btn is inactive, trying again in " + ts); console.log("Farm " + xFarmId + " not ready, trying again in " + ts);
wnd.close(); wnd.close();
timeout = seconds * 1000 + 1000; timeout = seconds * 1000 + 1000;