intel-screenbot

An Ingress Intel Map Bot for Hangoutsbot
git clone git://archive.git.mtrnord.blog/MTRNord/intel-screenbot.git
Log | Files | Refs | README | LICENSE

commit 9fd10e6a7ed32ad30d8b3e189e4dd1017bce60f8
parent 763029519939e5638091ce5e343e98fc3c57af29
Author: Marcel <MTRNord@users.noreply.github.com>
Date:   Tue, 15 Nov 2016 20:45:47 +0100

Applay fixes from iitc to intel
Diffstat:
Mscreencap_intel.js | 109+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
1 file changed, 68 insertions(+), 41 deletions(-)

diff --git a/screencap_intel.js b/screencap_intel.js @@ -100,50 +100,77 @@ function storeCookies() { } function login(l, p) { - page.evaluate(function (l) { - document.getElementById('Email').value = l; - }, l); - page.evaluate(function () { - document.querySelector("#next").click(); - }); - window.setTimeout(function () { - page.evaluate(function (p) { - document.getElementById('Passwd').value = p; - }, p); - page.evaluate(function () { - document.querySelector("#next").click(); - }); - page.evaluate(function () { - document.getElementById('gaia_loginform').submit(); - }); - window.setTimeout(function () { - if (page.url.substring(0,40) === 'https://accounts.google.com/ServiceLogin') { - quit('login failed: wrong email and/or password'); - } + if (document.querySelector('#timeoutError')){ + login(l, p) + firePlainLogin(l, p) + } + waitFor({ + timeout: 240000, + check: function () { + return page.evaluate(function() { + if (document.querySelector('#gaia_loginform')) { + return true; + }else{ + return false; + } + }); + }, + success: function () { + page.evaluate(function (l) { + document.getElementById('Email').value = l; + }, l); + page.evaluate(function () { + document.querySelector("#next").click(); + }); + window.setTimeout(function () { + page.evaluate(function (p) { + document.getElementById('Passwd').value = p; + }, p); + if(document.querySelector("#next")){ + page.evaluate(function () { + document.querySelector("#next").click(); + }); + }else{ + page.evaluate(function () { + document.querySelector("#signIn").click(); + }); + } + page.evaluate(function () { + document.getElementById('gaia_loginform').submit(); + }); + window.setTimeout(function () { + if (page.url.substring(0,40) === 'https://accounts.google.com/ServiceLogin') { + quit('login failed: wrong email and/or password'); + } - if (page.url.substring(0,40) === 'https://appengine.google.com/_ah/loginfo') { - page.evaluate(function () { - document.getElementById('persist_checkbox').checked = true; - document.getElementsByTagName('form').submit(); - }); - } + if (page.url.substring(0,40) === 'https://appengine.google.com/_ah/loginfo') { + page.evaluate(function () { + document.getElementById('persist_checkbox').checked = true; + document.getElementsByTagName('form').submit(); + }); + } - if (page.url.substring(0,44) === 'https://accounts.google.com/signin/challenge') { - twostep = system.stdin.readLine(); - } + if (page.url.substring(0,44) === 'https://accounts.google.com/signin/challenge') { + twostep = system.stdin.readLine(); + } -// if (twostep) { -// page.evaluate(function (code) { -// document.getElementById('totpPin').value = code; -// }, twostep); -// page.evaluate(function () { -// document.getElementById('submit').click(); -// document.getElementById('challenge').submit(); -// }); -// } - window.setTimeout(afterPlainLogin(IntelURL, search), loginTimeout); - }, loginTimeout) - }, loginTimeout / 10); + // if (twostep) { + // page.evaluate(function (code) { + // document.getElementById('totpPin').value = code; + // }, twostep); + // page.evaluate(function () { + // document.getElementById('submit').click(); + // document.getElementById('challenge').submit(); + // }); + // } + window.setTimeout(afterPlainLogin(IntelURL, search), loginTimeout); + }, loginTimeout) + }, loginTimeout / 10); + }, + error: function () { + quit(); + } + }); } function afterPlainLogin(IntelURL, search) {