mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 00:29:53 -05:00
More refinements.
This commit is contained in:
parent
8d225b8859
commit
5ea12fd053
@ -33,13 +33,16 @@ var umbraState = {'idleSince':null,'expectingSomething':null,'bottomReachedScrol
|
|||||||
var umbraIntervalFunc = function() {
|
var umbraIntervalFunc = function() {
|
||||||
|
|
||||||
var thingsToScroll = document.querySelectorAll(UMBRA_THINGS_TO_SCROLL_SELECTOR);
|
var thingsToScroll = document.querySelectorAll(UMBRA_THINGS_TO_SCROLL_SELECTOR);
|
||||||
|
var everythingScrolled = true;
|
||||||
|
|
||||||
for (var i = 0; i < thingsToScroll.length; i++) {
|
for (var i = 0; i < thingsToScroll.length; i++) {
|
||||||
var target = thingsToScroll[i];
|
var target = thingsToScroll[i];
|
||||||
|
|
||||||
if (!(target in umbraAlreadyScrolledThing)) {
|
if (!(target in umbraAlreadyScrolledThing)) {
|
||||||
|
|
||||||
console.log("scrolling to " + target.scrollHeight + " on element of type " + target.nodeName + " with id of " + target.id);
|
everythingScrolled = false;
|
||||||
|
|
||||||
|
console.log("scrolling to " + target.scrollHeight + " on element with nodeName " + target.nodeName + " with id of " + target.id);
|
||||||
var lastScrollTop = target.scrollTop;
|
var lastScrollTop = target.scrollTop;
|
||||||
target.scrollTop = target.scrollHeight;
|
target.scrollTop = target.scrollHeight;
|
||||||
|
|
||||||
@ -66,12 +69,20 @@ var umbraIntervalFunc = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("done scrolling for element of type " + target.nodeName + " with id of " + target.id)
|
console.log("done scrolling for element with nodeName " + target.nodeName + " with id of " + target.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
umbraState.expectingSomething = null;
|
umbraState.expectingSomething = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thingsToScroll && thingsToScroll.length > 0 && everythingScrolled) {
|
||||||
|
if (umbraState.idleSince == null) {
|
||||||
|
umbraState.idleSince = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var closeButtons = document.querySelectorAll('a[title="Close"], a.closeTheater');
|
var closeButtons = document.querySelectorAll('a[title="Close"], a.closeTheater');
|
||||||
for (var i = 0; i < closeButtons.length; i++) {
|
for (var i = 0; i < closeButtons.length; i++) {
|
||||||
// XXX closeTheater buttons stick around in the dom after closing, clientWidth>0 is one way to check if they're visible
|
// XXX closeTheater buttons stick around in the dom after closing, clientWidth>0 is one way to check if they're visible
|
||||||
@ -152,10 +163,6 @@ var UMBRA_USER_ACTION_IDLE_TIMEOUT_SEC = 10;
|
|||||||
// Called from outside of this script.
|
// Called from outside of this script.
|
||||||
var umbraBehaviorFinished = function() {
|
var umbraBehaviorFinished = function() {
|
||||||
|
|
||||||
console.log("xx " + umbraState.idleSince);
|
|
||||||
var idleTimeMs = Date.now() - umbraState.idleSince;
|
|
||||||
console.log(idleTimeMs / 1000 > UMBRA_USER_ACTION_IDLE_TIMEOUT_SEC);
|
|
||||||
|
|
||||||
if (umbraState.idleSince != null) {
|
if (umbraState.idleSince != null) {
|
||||||
var idleTimeMs = Date.now() - umbraState.idleSince;
|
var idleTimeMs = Date.now() - umbraState.idleSince;
|
||||||
if (idleTimeMs / 1000 > UMBRA_USER_ACTION_IDLE_TIMEOUT_SEC) {
|
if (idleTimeMs / 1000 > UMBRA_USER_ACTION_IDLE_TIMEOUT_SEC) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user