您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Turn Youtube player to theater mode automatically.
当前为
// ==UserScript== // @name Youtube automatic theater. // @namespace http://tampermonkey.net/ // @version 2024-02-15 // @description Turn Youtube player to theater mode automatically. // @author Santeri Hetekivi // @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'; function forElement(selector, callback) { // Init forElement.timeoutCount. if (forElement.timeoutCount === undefined) { forElement.timeoutCount = {} } // Init forElement.timeoutCount[selector]. if (forElement.timeoutCount[selector] === undefined) { forElement.timeoutCount[selector] = 0 } // Get element. const element = document.querySelector(selector) // If element not found. if (element === null) { console.debug("Element not found:", selector) // try again after timeout. setTimeout( function () { forElement(selector, callback) }, ( // Base timeout. 100 * // Increase timeout after each try. (forElement.timeoutCount[selector]++) ) ) } // If element found else { // reset timeout count console.debug("Element found:", selector, element) forElement.timeoutCount[selector] = 0 // and call callback with element. callback(element) } } // Run for forElement( // Youtube page manager ".ytd-page-manager", function (manager) { // If theater mode is on, just return. if (manager.theater) { return } // Run for forElement( // Youtube size button ".ytp-size-button", function (button) { // click it. button.click() } ) } ) })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址