Skip to content

Instantly share code, notes, and snippets.

@yyaabboopp
Created June 29, 2016 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yyaabboopp/c976468cef936c8f3693acfe23522c97 to your computer and use it in GitHub Desktop.
Save yyaabboopp/c976468cef936c8f3693acfe23522c97 to your computer and use it in GitHub Desktop.
Disable YouTube Autoplay automatically
// ==UserScript==
// @version 1.0.0
// @name Autoplay Off
// @description Sets Autoplay to `Off` by default
// @include http*://*.youtube.com/*
// @run-at document-end
// @grant none
// @noframes
// ==/UserScript==
(function () {
'use strict';
function disableAutoplay() {
setTimeout(function() {
var checkbox = document.getElementById('autoplay-checkbox');
if (checkbox && checkbox.checked === true) {
checkbox.click();
}
}, 2000);
}
window.addEventListener('readystatechange', disableAutoplay, true);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment