Created
January 9, 2017 11:08
-
-
Save elnygren/6f1c501dd8bdb2a4f387b2efe9f051cd to your computer and use it in GitHub Desktop.
See all fb activity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // goto `https://www.facebook.com/${username}/allactivity` | |
| // aka the Activity Log | |
| const getDocHeight = () => Math.max( | |
| document.body.scrollHeight, document.documentElement.scrollHeight, | |
| document.body.offsetHeight, document.documentElement.offsetHeight, | |
| document.body.clientHeight, document.documentElement.clientHeight | |
| ) | |
| // http://stackoverflow.com/a/31987330 | |
| function scrollTo(element, to, duration) { | |
| if (duration <= 0) return; | |
| const difference = to - element.scrollTop; | |
| const perTick = difference / duration * 10; | |
| setTimeout(function() { | |
| element.scrollTop = element.scrollTop + perTick; | |
| if (element.scrollTop === to) return; | |
| scrollTo(element, to, duration - 10); | |
| }, 10); | |
| } | |
| const scrollDown = () => scrollTo(document.body, window.scrollY + 100, 1) | |
| const interval = setInterval(scrollDown, 300) | |
| // TODO: figure out when everything loaded | |
| // clearInterval(interval) to stop | |
| // TODO: algo to hit unlike, delete etc. buttons |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment