More changes

This commit is contained in:
Hunter Stern 2015-09-16 09:23:13 -07:00
parent 3467670900
commit 5ccc535f51

View File

@ -44,13 +44,11 @@ var umbraSimpleScrollsAndClicksBehavior = {
if (umbraEndConditionTarget) { if (umbraEndConditionTarget) {
if (cssSelectorClickComputedStyleEndCondition != "") { if (cssSelectorClickComputedStyleEndCondition != "") {
var dynamicCode = umbraCreateDynamicCodeToCheckSelectorCondition(cssSelectorClickComputedStyleEndCondition); if (umbraCheckSelectorEndCondition(cssSelectorClickComputedStyleEndCondition)) {
if (eval(dynamicCode)) {
return; return;
} }
} }
else if (cssSelectorClickComputedStyleEndCondition == "") { else {
return; return;
} }
} }
@ -89,19 +87,16 @@ var umbraSimpleScrollsAndClicksBehavior = {
if (!clickedSomething) { if (!clickedSomething) {
if (somethingLeftAbove) { if (somethingLeftAbove) {
console console.log("scrolling UP because everything on this screen has been clicked but we missed something above");
.log("scrolling UP because everything on this screen has been clicked but we missed something above");
window.scrollBy(0, -500); window.scrollBy(0, -500);
this.idleSince = null; this.idleSince = null;
} else if (somethingLeftBelow) { } else if (somethingLeftBelow) {
console console.log("scrolling because everything on this screen has been clicked but there's more below document.body.clientHeight="
.log("scrolling because everything on this screen has been clicked but there's more below document.body.clientHeight="
+ document.body.clientHeight); + document.body.clientHeight);
window.scrollBy(0, 200); window.scrollBy(0, 200);
this.idleSince = null; this.idleSince = null;
} else if (window.scrollY + window.innerHeight < document.documentElement.scrollHeight) { } else if (window.scrollY + window.innerHeight < document.documentElement.scrollHeight) {
console console.log("scrolling because we're not to the bottom yet document.body.clientHeight="
.log("scrolling because we're not to the bottom yet document.body.clientHeight="
+ document.body.clientHeight); + document.body.clientHeight);
window.scrollBy(0, 200); window.scrollBy(0, 200);
this.idleSince = null; this.idleSince = null;
@ -133,7 +128,7 @@ var umbraSimpleScrollsAndClicksBehavior = {
}, },
}; };
var umbraCreateDynamicCodeToCheckSelectorCondition = function(condition) { var umbraCheckSelectorEndCondition = function(condition) {
if (!condition || condition == "") return; if (!condition || condition == "") return;
return eval("var dynamicFunction = new Function('return function testCondition(target){ if (!target) return false; var computedStyle=window.getComputedStyle(target); return computedStyle." + condition + " }' )(); dynamicFunction(umbraEndConditionTarget);"); return eval("var dynamicFunction = new Function('return function testCondition(target){ if (!target) return false; var computedStyle=window.getComputedStyle(target); return computedStyle." + condition + " }' )(); dynamicFunction(umbraEndConditionTarget);");