Last active
September 18, 2020 19:31
-
-
Save KevinRobertAndrews/987c0207c66948560e270d4bf126a28c to your computer and use it in GitHub Desktop.
This file contains 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
// 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