-
-
Save codeasashu/005d046b355727bc8b01 to your computer and use it in GitHub Desktop.
Force turns off autoplay and annotations on all youtube pages (Waits 10sec for page load)
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== | |
// @name KillAutoplay | |
// @namespace http://www.sysadminarena.com/ntsk | |
// @description Turns off annoying Youtube features | |
// @include /^https?://www\.youtube\.com/.*$/ | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js | |
// @run-at document-end | |
// @version 2.0.1 | |
// @grant none | |
// ==/UserScript== | |
// NOTE: The normal $(document).ready(function{...}); syntax for whatever reason doesn't work, worth looking into by someone. Shitty timer is shitty. | |
setTimeout( | |
function(){ | |
//activate the settings menu - without this we can't click anything else | |
document.querySelectorAll(".ytp-settings-button").item(0).click(); | |
//autoplay | |
if(document.querySelectorAll("div[role='menuitemcheckbox']")[0].getAttribute("aria-checked") == "true") | |
document.querySelectorAll("div[role='menuitemcheckbox']")[0].click(); | |
//annotations | |
if(document.querySelectorAll("div[role='menuitemcheckbox']")[1].getAttribute("aria-checked") == "true") | |
document.querySelectorAll("div[role='menuitemcheckbox']")[1].click(); | |
} | |
, 10000); | |
//Alternative Method - I've found gets overridden by the actual player, thus the timeout to wait around for the doc to load. | |
// if(document.getElementById("autoplay-checkbox").checked) $( "#autoplay-checkbox" ).trigger( "click" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment