diff --git a/umbra/behaviors.d/simpleclicks.js.in b/umbra/behaviors.d/simpleclicks.js.in index ee4a23c..1f6bcbd 100644 --- a/umbra/behaviors.d/simpleclicks.js.in +++ b/umbra/behaviors.d/simpleclicks.js.in @@ -44,13 +44,11 @@ var umbraSimpleScrollsAndClicksBehavior = { if (umbraEndConditionTarget) { if (cssSelectorClickComputedStyleEndCondition != "") { - var dynamicCode = umbraCreateDynamicCodeToCheckSelectorCondition(cssSelectorClickComputedStyleEndCondition); - - if (eval(dynamicCode)) { + if (umbraCheckSelectorEndCondition(cssSelectorClickComputedStyleEndCondition)) { return; } } - else if (cssSelectorClickComputedStyleEndCondition == "") { + else { return; } } @@ -89,19 +87,16 @@ var umbraSimpleScrollsAndClicksBehavior = { if (!clickedSomething) { if (somethingLeftAbove) { - console - .log("scrolling UP because everything on this screen has been clicked but we missed something above"); + console.log("scrolling UP because everything on this screen has been clicked but we missed something above"); window.scrollBy(0, -500); this.idleSince = null; } else if (somethingLeftBelow) { - console - .log("scrolling because everything on this screen has been clicked but there's more below document.body.clientHeight=" + 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); this.idleSince = null; } else if (window.scrollY + window.innerHeight < document.documentElement.scrollHeight) { - console - .log("scrolling because we're not to the bottom yet document.body.clientHeight=" + console.log("scrolling because we're not to the bottom yet document.body.clientHeight=" + document.body.clientHeight); window.scrollBy(0, 200); this.idleSince = null; @@ -133,7 +128,7 @@ var umbraSimpleScrollsAndClicksBehavior = { }, }; -var umbraCreateDynamicCodeToCheckSelectorCondition = function(condition) { +var umbraCheckSelectorEndCondition = function(condition) { 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);");