Old YouTube Studio Restorer (Pre-Jun 2024)

Restores the old YouTube Studio button styles and layout (pre-June 2024)

// ==UserScript==
// @name         Old YouTube Studio Restorer (Pre-Jun 2024)
// @namespace    https://greasyfork.org/users/yourname
// @version      1.0
// @description  Restores the old YouTube Studio button styles and layout (pre-June 2024)
// @author       YourName
// @match        https://studio.youtube.com/*
// @icon         https://www.youtube.com/s/desktop/6d82a3a2/img/favicon_32x32.png
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Wait for the DOM to load fully
    const waitForElement = (selector, callback) => {
        const interval = setInterval(() => {
            const el = document.querySelector(selector);
            if (el) {
                clearInterval(interval);
                callback(el);
            }
        }, 300);
    };

    // Function to style the buttons to look like old ones
    function styleOldButtons() {
        GM_addStyle(`
            /* General Button Reset */
            ytcd-button, yt-button-shape button, ytcp-button {
                background-color: #fff !important;
                border: 1px solid #ccc !important;
                color: #000 !important;
                font-weight: bold !important;
                border-radius: 2px !important;
                box-shadow: 0 1px 0 rgba(0,0,0,0.1);
                padding: 6px 12px !important;
                transition: background 0.3s;
            }

            /* Hover State */
            ytcd-button:hover, yt-button-shape button:hover, ytcp-button:hover {
                background-color: #f0f0f0 !important;
                border-color: #999 !important;
            }

            /* Primary Buttons */
            ytcd-button[variant="primary"], ytcp-button[variant="primary"] {
                background-color: #4285f4 !important;
                color: #fff !important;
                border-color: #357ae8 !important;
            }

            ytcd-button[variant="primary"]:hover, ytcp-button[variant="primary"]:hover {
                background-color: #3367d6 !important;
                border-color: #2a56c6 !important;
            }
        `);
    }

    // Observe for dynamically loaded buttons
    const observer = new MutationObserver(() => {
        styleOldButtons();
    });

    waitForElement('body', () => {
        styleOldButtons();
        observer.observe(document.body, { childList: true, subtree: true });
    });
})();