diff --git a/disable-youtube-autoplay.user.js b/disable-youtube-autoplay.user.js index a963b40..508e9f2 100644 --- a/disable-youtube-autoplay.user.js +++ b/disable-youtube-autoplay.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Turn off Youtube Autoplay // @namespace https://bubbletea.dev/ -// @version 2.0 +// @version 2.1.0 // @description Disables Youtube recommended videos from automatically playing // @author shibao // @include https://www.youtube.com/watch* @@ -42,12 +42,10 @@ function eachNode(rootNode, callback) { for (const addedNode of mutation.addedNodes) { // recurses through all child nodes as well eachNode(addedNode, function (node) { - if (node.nodeName == 'DIV' && + node.nodeName == 'DIV' && node.classList.contains('ytp-autonav-toggle-button') && - node.getAttribute('aria-checked') == "true") { - const button = node.closest("button"); - if (button) { setTimeout(() => button.click(), 1000); } - } + node.getAttribute('aria-checked') == "true" && + node.click(); }); } };