Always shows the default YouTube logo, never the premium one, and hides yoodle
当前为
// ==UserScript==
// @name YouTube Always Default Logo (No Premium, No Yoodle)
// @version 1.0.0
// @description Always shows the default YouTube logo, never the premium one, and hides yoodle
// @author barraIhsan (modded by 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';
// Trusted Types fix for Chromium
if (window.trustedTypes && trustedTypes.createPolicy) {
if (!trustedTypes.defaultPolicy) {
const passThroughFn = (x) => x;
trustedTypes.createPolicy('default', {
createHTML: passThroughFn,
createScriptURL: passThroughFn,
createScript: passThroughFn,
});
}
}
window.addEventListener('load', () => {
function restoreDefaultLogo() {
// Show all normal logos
document
.querySelectorAll('.ytd-topbar-logo-renderer[hidden]')
.forEach((el) => el.removeAttribute('hidden'));
// Remove any custom SVG injected by other scripts (like premium logo)
document.querySelectorAll('ytd-logo').forEach((ytdLogo) => {
// Remove is-red-logo attribute if present
ytdLogo.removeAttribute('is-red-logo');
// Try to restore the original SVG if it was replaced
const svg = ytdLogo.querySelector('svg');
if (svg) {
// If the SVG was replaced, reload the page section to restore it
// (YouTube will re-render the logo on navigation, so just remove custom content)
// Optionally, you can try to reload the logo by removing the SVG and letting YouTube re-render it
// But usually, just removing custom attributes is enough
}
});
// Hide yoodle using the hidden attribute (from youtube)
document
.querySelectorAll('ytd-yoodle-renderer')
.forEach((el) => el.setAttribute('hidden', ''));
// Change the tooltip when hovering youtube logo
document
.querySelectorAll('a#logo')
.forEach((el) => el.setAttribute('title', 'YouTube Home'));
}
function checkLogo() {
// Always restore the default logo, regardless of login state
restoreDefaultLogo();
}
// Observe changes in the DOM
const observer = new MutationObserver(checkLogo);
observer.observe(document.body, { childList: true, subtree: true });
// Initial run
checkLogo();
});
})();