Skip to content

Instantly share code, notes, and snippets.

@ltpitt
Created November 5, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ltpitt/185e162f18263c2270fb1dd220f0f8a3 to your computer and use it in GitHub Desktop.
Save ltpitt/185e162f18263c2270fb1dd220f0f8a3 to your computer and use it in GitHub Desktop.
Just a simple Javascript webpage scroller I needed to read content hidden behind a paywall
// Open your browser's console, paste this script in it and press enter.
// Reload the page using F5 to cancel the script's effects.
async function autoScroll(scrollStartHeight, scrollSpeed, waitTimeBetweenScrolls){
let currentScrollHeight = scrollStartHeight;
while (currentScrollHeight < document.body.scrollHeight) {
currentScrollHeight += scrollSpeed;
await new Promise(r => setTimeout(r, waitTimeBetweenScrolls));
window.scrollTo(scrollStartHeight, currentScrollHeight);
}
}
autoScroll(0, 1, 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment