YouTube Default Logo (Remove Premium Text, Always)

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

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==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();
})();