mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-19 23:35:54 -04:00
ARI-4016 - Support: embedded videos on marquette.edu
This commit is contained in:
parent
9052fd8569
commit
5a3c8e9a05
56
umbra/behaviors.d/marquette_edu.js
Normal file
56
umbra/behaviors.d/marquette_edu.js
Normal file
@ -0,0 +1,56 @@
|
||||
// {"url_regex":"^https?://(?:www\\.)?marquette\\.edu/.*$", "request_idle_timeout_sec":10}
|
||||
//
|
||||
// vim:set sw=8 et:
|
||||
//
|
||||
|
||||
var umbraState = {'idleSince':null,'done':null};
|
||||
|
||||
|
||||
var intervalID = setInterval(scrollInterval,50);
|
||||
var images;
|
||||
var imageID=0;
|
||||
var imageCount=0;
|
||||
function scrollInterval() {
|
||||
scroll();
|
||||
|
||||
//if not at the bottom
|
||||
if(window.scrollY + window.innerHeight < document.documentElement.scrollHeight) {
|
||||
umbraState.idleSince=Date.now();
|
||||
}
|
||||
else {
|
||||
clearInterval(intervalID);
|
||||
umbraState.idleSince=null;
|
||||
var videoBox = document.querySelectorAll("div#vid_box a");
|
||||
if(videoBox.length>0) {
|
||||
for(i=0;i<videoBox.length;i++) {
|
||||
videoBox[i].click();
|
||||
umbraState.idleSince=Date.now();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scroll() {
|
||||
window.scrollBy(0,50);
|
||||
}
|
||||
|
||||
|
||||
// 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.done!=null && umbraState.done==true) {
|
||||
return true;
|
||||
}
|
||||
if (umbraState.idleSince != null) {
|
||||
var idleTimeMs = Date.now() - umbraState.idleSince;
|
||||
if (idleTimeMs / 1000 > UMBRA_USER_ACTION_IDLE_TIMEOUT_SEC) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user