Skip to content

Instantly share code, notes, and snippets.

@elnygren
Created January 9, 2017 11:08
Show Gist options
  • Select an option

  • Save elnygren/6f1c501dd8bdb2a4f387b2efe9f051cd to your computer and use it in GitHub Desktop.

Select an option

Save elnygren/6f1c501dd8bdb2a4f387b2efe9f051cd to your computer and use it in GitHub Desktop.
See all fb activity
// 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