您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Persistently toggle the opacity of YouTube video elements with Shift+Space. won't reduce internet usage.
// ==UserScript== // @name YouTube Video Hider Shift+Space // @namespace http://tampermonkey.net/ // @version 1.2 // @description Persistently toggle the opacity of YouTube video elements with Shift+Space. won't reduce internet usage. // @author Sina Yaqubi // @match *://*.youtube.com/* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; const STORAGE_KEY = 'userScript_youtubeVideoHidden_67x812b'; // Function to apply the saved state function applyState() { const videoElement = document.querySelector('.html5-video-container > video'); if (videoElement) { const isHidden = localStorage.getItem(STORAGE_KEY) === 'true'; videoElement.style.opacity = isHidden ? '0' : ''; // Hide or reset opacity } } // Function to toggle the visibility state function toggleState() { const currentState = localStorage.getItem(STORAGE_KEY) === 'true'; const newState = !currentState; localStorage.setItem(STORAGE_KEY, newState.toString()); applyState(); } // Apply the state when the page loads window.addEventListener('load', applyState); // Listen for the shortcut key document.addEventListener('keydown', (event) => { if (event.key === ' ' && event.shiftKey) { event.preventDefault(); // Prevent default behavior toggleState(); } }); })();