Forked from jeffmbellucci/disable_youtube_autoplay.js
Last active
August 2, 2021 08:27
-
-
Save aluxian/5344aa0ee5fa0d8a154add902eaff8ba to your computer and use it in GitHub Desktop.
Turn off/disable YouTube autoplay 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== | |
// @name Disable YouTube Autoplay | |
// @version 1.0 | |
// @match *://www.youtube.com/* | |
// @run-at document-start | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
function disable() { | |
let a = document.querySelector( | |
"button.ytp-button[data-tooltip-target-id='ytp-autonav-toggle-button']" | |
); // get the button | |
if (a.getAttribute("aria-label") == "Autoplay is on") { | |
a.click(); // disable autoplay next if enabled | |
} | |
} | |
setTimeout(disable, 3000); | |
setTimeout(disable, 9000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment