YouTube Default Logo (Remove Premium Text, Always)

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

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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