mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 00:29:53 -05:00
simpleclicks - only click if element is visible, fixes spinning on moma.org sites
This commit is contained in:
parent
38d9eee68d
commit
766441e65c
@ -22,6 +22,13 @@ var umbraBehavior = {
|
||||
idleSince : null,
|
||||
alreadyClicked : {},
|
||||
|
||||
// https://github.com/jquery/jquery/blob/master/src/css/hiddenVisibleSelectors.js
|
||||
// n.b. returns true for elements with visibility:hidden, which occupy
|
||||
// screen real estate but are not visible, or clickable with the ui
|
||||
isVisible : function(elem) {
|
||||
return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
|
||||
},
|
||||
|
||||
intervalFunc : function() {
|
||||
var clickedSomething = false;
|
||||
var somethingLeftBelow = false;
|
||||
@ -38,10 +45,11 @@ var umbraBehavior = {
|
||||
}
|
||||
|
||||
for (var j = 0; j < documents.length; j++) {
|
||||
|
||||
var clickTargets = documents[j].querySelectorAll(cssSelector);
|
||||
|
||||
for ( var i = 0; i < clickTargets.length; i++) {
|
||||
if (!this.isVisible(clickTargets[i])) {
|
||||
continue;
|
||||
}
|
||||
if (clickTargets[i].umbraClicked && !clickUntilTimeout) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user