From 686497501b052a00383d838a34b0d3565a2ca58c Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Sun, 10 Feb 2013 19:39:28 +0100 Subject: [PATCH] catch being logged in, but stating that the account is not allowed to play ingress. It will simply reload the page right now after 10s. The user is probably faster to do this manually, but it solves the problem where the tab is opened and forgotten. --- main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.js b/main.js index 0def816c..596b916f 100644 --- a/main.js +++ b/main.js @@ -28,6 +28,19 @@ for(var x in scr) { break; } + +if(!d) { + // page doesn’t have a script tag with player information. + if(document.getElementById('header_email')) { + // however, we are logged in. + setTimeout('location.reload();', 10*1000); + throw('Page doesn’t have player data, but you are logged in. Reloading in 10s.'); + } + // FIXME: handle nia takedown in progress + throw('Couldn’t retrieve player data. Are you logged in?'); +} + + for(var i = 0; i < d.length; i++) { if(!d[i].match('var PLAYER = ')) continue; eval(d[i].match(/^var /, 'window.'));