YouTube Default Logo (Remove Premium Text, Always)

Always shows the default YouTube logo, removes "Premium" text and yoodle, and keeps it that way

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         YouTube Default Logo (Remove Premium Text, Always)
// @version      1.5.0
// @description  Always shows the default YouTube logo, removes "Premium" text and yoodle, and keeps it that way
// @author       T3 Chat
// @match        https://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?domain=youtube.com
// @namespace https://greatest.deepsurf.us/users/1412746
// ==/UserScript==

(function () {
    'use strict';

    // Hide yoodle with CSS
    const style = document.createElement('style');
    style.textContent = `
        ytd-yoodle-renderer {
            display: none !important;
        }
    `;
    document.head.appendChild(style);

    // Remove "Premium" text node or element from logo area
    function removePremiumText() {
        const logoRenderer = document.querySelector('ytd-topbar-logo-renderer');
        if (!logoRenderer) return;

        // Remove is-red-logo attribute to avoid premium logo
        logoRenderer.removeAttribute('is-red-logo');
        logoRenderer.querySelectorAll('ytd-logo[is-red-logo]').forEach(el => {
            el.removeAttribute('is-red-logo');
        });

        // Find the <a id="logo"> link
        const logoLink = logoRenderer.querySelector('a#logo');
        if (!logoLink) return;

        // Remove any element or text node that contains "Premium"
        Array.from(logoLink.childNodes).forEach(node => {
            // Remove text nodes with "Premium"
            if (
                node.nodeType === Node.TEXT_NODE &&
                node.textContent.trim().toLowerCase().startsWith('premium')
            ) {
                node.textContent = '';
            }
            // Remove elements with "Premium" text
            if (
                node.nodeType === Node.ELEMENT_NODE &&
                node.textContent.trim().toLowerCase().startsWith('premium')
            ) {
                node.style.display = 'none';
            }
        });
    }

    // Observe the logo area for any changes
    function observeLogo() {
        const logoRenderer = document.querySelector('ytd-topbar-logo-renderer');
        if (!logoRenderer) return;
        const logoObserver = new MutationObserver(removePremiumText);
        logoObserver.observe(logoRenderer, { childList: true, subtree: true });
        // Initial fix
        removePremiumText();
    }

    // Observe the body for the logo renderer to appear
    const bodyObserver = new MutationObserver(() => {
        if (document.querySelector('ytd-topbar-logo-renderer')) {
            observeLogo();
        }
    });
    bodyObserver.observe(document.body, { childList: true, subtree: true });

    // Initial run (in case logo is already present)
    observeLogo();
})();