Created
February 18, 2023 03:04
-
-
Save Rochdy/aeadab548fb657cb1e90c3b5b1b30038 to your computer and use it in GitHub Desktop.
Auto scroll youtube shorts
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
| const observer = new MutationObserver( | |
| (mutationList, observer) => { | |
| for (const mutation of mutationList) { | |
| if (mutation.type === 'attributes' && mutation.target.localName === 'video') { | |
| //Change the video playback speed if you think people are boring | |
| //mutation.target.playbackRate = 1.25; | |
| mutation.target.loop = false; | |
| mutation.target.onended = (e) => document.getElementById('shorts-container').scrollTop += mutation.target.scrollHeight; | |
| } | |
| } | |
| } | |
| ); | |
| observer.observe(document.getElementById('shorts-container'), { attributes: true, childList: true, subtree: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment