Skip to content

Instantly share code, notes, and snippets.

@KevinRobertAndrews
Last active September 18, 2020 19:31
Show Gist options
  • Save KevinRobertAndrews/987c0207c66948560e270d4bf126a28c to your computer and use it in GitHub Desktop.
Save KevinRobertAndrews/987c0207c66948560e270d4bf126a28c to your computer and use it in GitHub Desktop.
// Hey there, I made a simple script to scroll up Messenger chats.
/* How to use:
1. On the desktop Messenger client, run the following code in the DevTools console.
2. start() // starts scrolling up the main chat window
3. stop() // stops scrolling
*/
let on = null;
const start = () => {
if (!on) {
scrollUp();
return "Scrolling up and up!!";
}
};
const stop = () => {
if (on) {
clearInterval(on);
on = null;
return "Scrolling stopped.";
}
};
// scrollUp() selects the middle chat window and scrolls up every 500 milliseconds
function scrollUp() {
on = setInterval(function () {
document
.querySelector("iframe")
.contentWindow.document.querySelectorAll(".scrollable")[2].scrollTop = 0;
}, 500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment