YouTube Classic Layout Fix

Restores normal YouTube layout and disables experimental UI changes.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         YouTube Classic Layout Fix
// @namespace    https://yournamehere.example
// @version      1.0
// @description  Restores normal YouTube layout and disables experimental UI changes.
// @author       You
// @match        https://www.youtube.com/*
// @match        https://youtube.com/*
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const css = `
    /* ================================
       YOUTUBE CLASSIC WATCH PAGE FIX
       Restores normal 2023–2024 layout
       ================================ */

    /* Fix overly large video player padding */
    ytd-watch-flexy[theater] #player-theater-container,
    ytd-watch-flexy #player-wide-container {
        max-width: 1280px !important;
        margin: 0 auto !important;
    }

    #player-container-inner,
    #player {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Restore right sidebar normal width */
    #secondary.ytd-watch-flexy {
        max-width: 420px !important;
        min-width: 350px !important;
    }

    /* Fix compact spacing YouTube added */
    ytd-video-primary-info-renderer,
    ytd-video-secondary-info-renderer {
        margin-left: 0 !important;
    }

    /* Remove Shorts shelf */
    ytd-reel-shelf-renderer,
    ytd-reel-shelf-renderer.ytd-item-section-renderer {
        display: none !important;
    }

    /* Remove "All / From this series / From SpongeDivers Music" filter chips */
    yt-chip-cloud-renderer {
        display: none !important;
    }

    /* Remove overly rounded corners from player */
    ytd-watch-flexy #player {
        border-radius: 0 !important;
    }

    /* Fix right-column compact video spacing */
    ytd-compact-video-renderer {
        padding: 6px 0 !important;
    }

    /* Keep the page centered instead of stretched */
    ytd-watch-flexy {
        max-width: 1750px !important;
        margin: 0 auto !important;
    }
    `;

    function addStyle() {
        const style = document.createElement("style");
        style.textContent = css;
        document.documentElement.appendChild(style);
    }

    addStyle();
})();