From 7d25e9fe1c957a103447df7f8f9da4628c848b9c Mon Sep 17 00:00:00 2001 From: vlw Date: Fri, 10 Apr 2026 18:07:16 +0200 Subject: [PATCH] add: userscript-disable-youtube-autoplay-next.js --- userscript-disable-youtube-autoplay-next.js | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 userscript-disable-youtube-autoplay-next.js diff --git a/userscript-disable-youtube-autoplay-next.js b/userscript-disable-youtube-autoplay-next.js new file mode 100644 index 0000000..383fc78 --- /dev/null +++ b/userscript-disable-youtube-autoplay-next.js @@ -0,0 +1,29 @@ +// ==UserScript== +// @name Disable YouTube "Autoplay next video" +// @namespace https://vlw.se/ +// @version 2026-04-10 +// @description Automatically disable autoplay of next video at the end of +// @author Victor Westerlund +// @match https://www.youtube.com/watch?v=* +// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + const disableAutoplay = () => { + const target = document.querySelector(".ytp-autonav-toggle-button"); + + // Mission accomplished + if (target && target.ariaChecked === "false") { + return; + } + + // Attempt to disable autoplay + target?.click(); + requestIdleCallback(disableAutoplay); + } + + requestIdleCallback(disableAutoplay); +})(); \ No newline at end of file