-
-
Save Chematronix/43c4212328821e408781513d9db97ed7 to your computer and use it in GitHub Desktop.
Removes the autoplay up next feature
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
// ==UserScript== | |
// @version 02--2017.09.12 | |
// @name Disable autoplay next in Youtube | |
// @description Turns off autoplay next video in Youtube after a few (WAIT_SECS) seconds when you first (re)load a page. You can toggle it back on anytime, if you want to go jukebox mode, and it will stay on as long as you don't reload the page. | |
// @match *://www.youtube.com/* | |
// @run-at document-idle | |
// @noframes | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
var SCRIPT_NAME = 'Disable autoplay next in Youtube'; | |
var WAIT_SECS = 3; | |
function disableAutoPlay() { | |
// Toggle AutoPlay button if it's enabled | |
if( document.getElementById('toggle').active ) document.getElementById('toggle').click(); | |
} | |
// Wait for the Next videos section to load | |
// Obsolete events are not working (readystatechange, spfdone), as expected. | |
// Couldn't get new ones to do it either (yt-navigate-* only seems to trigger after navigating to *another* video). | |
// Good old timeout does the trick tho | |
setTimeout(disableAutoPlay, WAIT_SECS*1000); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I appreciate your clarification. I'll delete my comments from the more public arena, aside from the one with the gist. Like you mentioned about taking little time on your re-write, initially, I spent only a few minutes fiddling in the console, to help make a working script again, I didn't refactor, or think that much about code quality.
Multiple people thanked the original author, which I think is appropriate, and I do my best to give credit where credit is due. I do think this field lacks a certain amount of mutual respect, and I have found over years of working with many devs, that there is a constant one-upmanship and concerted attempts to find flaws in other's work. I'll never understand that. I don't think it fosters cooperation or makes people want to join our field.
I studied economics and computer science in college, but graduated into the dotcom bust, so I chose to pursue EMS instead of development after school. About 5 years ago, I went back into the software industry because it was burgeoning again. Coming from being a paramedic and firefighter, where teamwork and positive communication is so important, I find the culture of software development frustrating much of the time. It has nothing to do with thick or thin skin, no one will bust your balls more than medics, cops, and fire guys. I find that type of negativity in software development counterproductive.
Anyway, you're more than welcome to code review my gist/script. I rewrote it to be more readable, from my point of view anyway. I know it's possible to make it shorter, I wrote it to make it clear, but people have different opinions on whether condensing code is a good or bad thing. More generally speaking, I won't make anymore assumptions about you, and I have no interest in a pissing match or trying to prove who is the most awesomest software superstar.
Take care.