mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 16:49:56 -05:00
28 lines
884 B
JavaScript
28 lines
884 B
JavaScript
// {"url_regex":"^https?://(?:www\\.)?vimeo\\.com/.*$", "request_idle_timeout_sec":10}
|
|
//
|
|
// vim:set sw=8 et:
|
|
//
|
|
|
|
var umbraState = {'idleSince':null};
|
|
var umbraVideoElements = document.getElementsByTagName('video');
|
|
for (var i = 0; i < umbraVideoElements.length; i++) {
|
|
umbraVideoElements[i].play();
|
|
}
|
|
umbraState.idleSince = Date.now();
|
|
|
|
// If we haven't had anything to do (scrolled, clicked, etc) in this amount of
|
|
// time, then we consider ourselves finished with the page.
|
|
var UMBRA_USER_ACTION_IDLE_TIMEOUT_SEC = 10;
|
|
|
|
// Called from outside of this script.
|
|
var umbraBehaviorFinished = function() {
|
|
if (umbraState.idleSince != null) {
|
|
var idleTimeMs = Date.now() - umbraState.idleSince;
|
|
if (idleTimeMs / 1000 > UMBRA_USER_ACTION_IDLE_TIMEOUT_SEC) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|