您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Optimizes YouTube performance without breaking UI elements
// ==UserScript== // @name YouTube Performance Booster (Fixed UI) // @version 2.1 // @description Optimizes YouTube performance without breaking UI elements // @author HYPERR. // @match *://*.youtube.com/* // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @run-at document-start // @license MIT // @namespace https://greasyfork.org/users/1476487 // ==/UserScript== (function() { 'use strict'; // ===== SAFE CONFIGURATION ===== const settings = { instantNavigation: true, // Smoother navigation disableAnimations: true, // Disable UI animations qualityPreset: 'auto', // Video quality (auto, 1080p, 720p etc) hideShorts: true // Only hides Shorts shelf }; // ===== SAFE CSS INJECTION ===== GM_addStyle(` /* Animation removal (safe) */ [no-animations] * { transition: none !important; animation: none !important; } /* Non-destructive hiding */ [hide-shorts] ytd-rich-section-renderer { display: none !important; } /* Layout-safe optimizations */ html { scroll-behavior: auto !important; } `); // Apply settings document.documentElement.setAttribute('no-animations', ''); if (settings.hideShorts) { document.documentElement.setAttribute('hide-shorts', ''); } // ===== SAFE PERFORMANCE OPTIMIZATIONS ===== function optimizePlayer() { const player = document.querySelector('video'); if (player) { player.addEventListener('canplay', function() { try { if (settings.qualityPreset !== 'auto') { player.setPlaybackQuality(settings.qualityPreset); } } catch(e) { /* Fail silently */ } }); } } // ===== SAFE INSTANT NAVIGATION ===== if (settings.instantNavigation) { document.addEventListener('mouseover', function(e) { const link = e.target.closest('a[href^="/watch"]'); if (link) { const preload = document.createElement('link'); preload.rel = 'prefetch'; preload.href = link.href; document.head.appendChild(preload); } }, {passive: true}); } // Initialize const observer = new MutationObserver(optimizePlayer); observer.observe(document, { childList: true, subtree: true }); window.addEventListener('load', optimizePlayer); })();