add initial userscript
This commit is contained in:
commit
7a14a9b917
24
disable-youtube-autoplay.js
Normal file
24
disable-youtube-autoplay.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name Turn off Youtube Autoplay
|
||||||
|
// @namespace https://bubbletea.dev/
|
||||||
|
// @version 1.0
|
||||||
|
// @description Disables Youtube recommended videos from automatically playing
|
||||||
|
// @author shibao
|
||||||
|
// @include https://www.youtube.com/watch*
|
||||||
|
// @grant none
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function disableAutoplay() {
|
||||||
|
var e = document.querySelector('button.ytp-button[data-tooltip-target-id="ytp-autonav-toggle-button"]');
|
||||||
|
if (e == null) {
|
||||||
|
console.error('Youtube checkbox could not be found!');
|
||||||
|
} else {
|
||||||
|
var isChecked = document.querySelector('.ytp-autonav-toggle-button').getAttribute('aria-checked') == "true";
|
||||||
|
if (isChecked) e.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
document.onLoad = setTimeout(disableAutoplay, 1000);
|
||||||
|
}) ();
|
Loading…
Reference in New Issue
Block a user