| 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; |