add: userscript-disable-youtube-autoplay-next.js
This commit is contained in:
commit
7d25e9fe1c
1 changed files with 29 additions and 0 deletions
29
userscript-disable-youtube-autoplay-next.js
Normal file
29
userscript-disable-youtube-autoplay-next.js
Normal file
|
|
@ -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);
|
||||
})();
|
||||
Loading…
Add table
Reference in a new issue