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 15d41289b448040616a6f6c52960f94000675c60
parent 9cb83f0c4e9b126d56b8cc7e3d128c14a1dbf392
Author: Marcel <MTRNord@users.noreply.github.com>
Date:   Sat, 31 Dec 2016 21:34:18 +0100

Need for finishing loading
Diffstat:
Mscreencap.js | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 73 insertions(+), 27 deletions(-)

diff --git a/screencap.js b/screencap.js @@ -221,36 +221,82 @@ function map(search){ function portalinfoScreen(){ setTimeout(function() { - page.evaluate(function() { - (function($) { - $.fn.allBut = function(context) { - var target = this; - var otherList = $(); - var processList = $(context || 'body').children(); - while (processList.size() > 0) { - var cElem = processList.first(); - processList = processList.slice(1); - if (cElem.filter(target).size() != target.size()) { - if (cElem.has(target).size() > 0) { - processList = processList.add(cElem.children()); - } else { - otherList = otherList.add(cElem); + page.viewportSize = { width: width, height: height }; + waitFor({ + timeout: 240000, + check: function () { + return page.evaluate(function() { + if (document.querySelector('.map').textContent.indexOf('done') != -1) { + return true; + }else{ + console.log('generateFakeOutput') + return false; + } + }); + }, + success: function () { + page.evaluate(function() { + (function($) { + $.fn.allBut = function(context) { + var target = this; + var otherList = $(); + var processList = $(context || 'body').children(); + while (processList.size() > 0) { + var cElem = processList.first(); + processList = processList.slice(1); + if (cElem.filter(target).size() != target.size()) { + if (cElem.has(target).size() > 0) { + processList = processList.add(cElem.children()); + } else { + otherList = otherList.add(cElem); + } } } - } - return otherList; - } - })(jQuery); - $('#sidebar').allBut().hide(); - }); - width = page.evaluate(function() { - return document.getElementById('sidebar').clientWidth; - }); - height = page.evaluate(function() { - return document.getElementById('sidebar').clientHeight; + return otherList; + } + })(jQuery); + $('#sidebar').allBut().hide(); + }); + width = page.evaluate(function() { + return document.getElementById('sidebar').clientWidth; + }); + height = page.evaluate(function() { + return document.getElementById('sidebar').clientHeight; + }); + setTimeout(function() {s(filepath)}, "1000"); + }, + error: function () { + page.evaluate(function() { + (function($) { + $.fn.allBut = function(context) { + var target = this; + var otherList = $(); + var processList = $(context || 'body').children(); + while (processList.size() > 0) { + var cElem = processList.first(); + processList = processList.slice(1); + if (cElem.filter(target).size() != target.size()) { + if (cElem.has(target).size() > 0) { + processList = processList.add(cElem.children()); + } else { + otherList = otherList.add(cElem); + } + } + } + return otherList; + } + })(jQuery); + $('#sidebar').allBut().hide(); + }); + width = page.evaluate(function() { + return document.getElementById('sidebar').clientWidth; + }); + height = page.evaluate(function() { + return document.getElementById('sidebar').clientHeight; + }); + setTimeout(function() {s(filepath)}, "1000"); + } }); - page.viewportSize = { width: width, height: height }; - setTimeout(function() {s(filepath)}, "1000"); }, "1000"); }