mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-20 23:56:34 -04:00
use site's nav JS
This commit is contained in:
parent
278994f5b0
commit
04944e2f94
@ -32,8 +32,7 @@ var UMBRA_N_USER_NAME = "${parameter_username}";
|
||||
var UMBRA_N_PASSWORD = "${parameter_password}";
|
||||
|
||||
var umbraState = {'idleSince':null};
|
||||
var umbraAlreadyClicked = {};
|
||||
var re = /(?:Previous){0,1}\s+(page \d+\/\d+)\s+(?:Next){0,1}/;
|
||||
var re = /(?:Previous){0,1}\s+(page (\d+)\/\d+)\s+(?:Next){0,1}/;
|
||||
|
||||
var umbraIntervalFunc = function() {
|
||||
var clickedSomething = false;
|
||||
@ -54,15 +53,10 @@ var umbraIntervalFunc = function() {
|
||||
if (target) {
|
||||
var where = umbraAboveBelowOrOnScreen(target);
|
||||
if (where === 0) {
|
||||
var mouseOverEvent = document.createEvent('Events');
|
||||
mouseOverEvent.initEvent("mouseover", true, false);
|
||||
target.dispatchEvent(mouseOverEvent);
|
||||
target.click();
|
||||
clickedSomething = true;
|
||||
umbraState.idleSince = null;
|
||||
var target_page = re.exec(document.querySelector("div.nav").textContent);
|
||||
console.log('clicked ' + target_page[1]);
|
||||
umbraAlreadyClicked[target_page] = true;
|
||||
console.log('loaded ' + target_page[1]);
|
||||
jQuery("#resultBox").load("/index.php/Search/Index/page/" + (+target_page[2] + 1));
|
||||
} else if (where > 0) {
|
||||
somethingLeftBelow = true;
|
||||
} else if (where < 0) {
|
||||
@ -70,24 +64,6 @@ var umbraIntervalFunc = function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!clickedSomething) {
|
||||
if (somethingLeftAbove) {
|
||||
// console.log("scrolling UP because everything on this screen has been clicked but we missed something above");
|
||||
window.scrollBy(0, -500);
|
||||
umbraState.idleSince = null;
|
||||
} else if (somethingLeftBelow) {
|
||||
// console.log("scrolling because everything on this screen has been clicked but there's more below document.body.clientHeight="
|
||||
// + document.body.clientHeight);
|
||||
window.scrollBy(0, 200);
|
||||
umbraState.idleSince = null;
|
||||
} else if (window.scrollY + window.innerHeight < document.documentElement.scrollHeight) {
|
||||
window.scrollBy(0, 200);
|
||||
umbraState.idleSince = null;
|
||||
} else if (umbraState.idleSince == null) {
|
||||
umbraState.idleSince = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
if (umbraState.idleSince == null) {
|
||||
umbraState.idleSince = Date.now();
|
||||
}
|
||||
|
@ -45,10 +45,6 @@ behaviors:
|
||||
url_regex: '^https?://(?:www\.)?instagram\.com/.*$'
|
||||
behavior_js: instagram.js
|
||||
request_idle_timeout_sec: 10
|
||||
-
|
||||
url_regex: '^https?://catalogue\.noguchi\.org/index.php$'
|
||||
behavior_js_template: noguchi.js.template
|
||||
request_idle_timeout_sec: 10
|
||||
-
|
||||
url_regex: '^https?://catalogue\.noguchi\.org/index.php/LoginReg/form$'
|
||||
behavior_js_template: noguchi.js.template
|
||||
|
Loading…
x
Reference in New Issue
Block a user