MCPcopy Create free account
hub / github.com/BloombergGraphics/whatiscode / logScroll

Function logScroll

modules/paulbot/paulbot.js:78–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 }
77
78 function logScroll() {
79 scrollLog.push({
80 "scrollTop": pageYOffset,
81 "timestamp": +(new Date())
82 });
83
84 if(scrollLog.length < 2) return;
85
86 var scrollSpeed =
87 (scrollLog[scrollLog.length-1].scrollTop - scrollLog[scrollLog.length-2].scrollTop) /
88 (scrollLog[scrollLog.length-1].timestamp - scrollLog[scrollLog.length-2].timestamp)
89
90 if(pageYOffset + innerHeight > $(document).height() - 400) {
91 completionThrottled();
92 } else if(scrollSpeed > 4 && fastSass.length) {
93 alertTooFastThrottled();
94 }
95 }
96
97 function completion() {
98 var timeOnPage = ((+new Date()) - loadTime) + stats.timeOnPage;

Callers 1

paulbot.jsFile · 0.70

Calls 1

$Function · 0.50

Tested by

no test coverage detected