YouTubeNeverSleeps

Disable video breaks. Disable youtube pause button. Auto confirm No Thanks Sign In to YouTube.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         YouTubeNeverSleeps
// @namespace    http://tampermonkey.net/
// @version      0.24
// @description  Disable video breaks. Disable youtube pause button. Auto confirm No Thanks Sign In to YouTube.
// @author       [email protected]
// @match        https://greasyfork.org/en/scripts/381682-html5%E8%A7%86%E9%A2%91%E6%92%AD%E6%94%BE%E5%99%A8%E5%A2%9E%E5%BC%BA%E8%84%9A%E6%9C%AC
// @match        https://www.youtube.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    console.log("Beaware! YouTube never sleeps!");

    setInterval(function() {
        
        //click No Thanks, Yes
        document.querySelectorAll('[aria-label="No thanks"], [aria-label="Yes"]').forEach( function(element) { if (element.offsetParent != null) element.click() } )
        
        //press play if paused for any other reason 
        if(document.querySelector('video').paused == true)
        {
            document.querySelector('video').play();
        }
    }, 1000);

})();