Skip to content

Instantly share code, notes, and snippets.

@todomodo
Last active March 26, 2026 01:48
Show Gist options
  • Select an option

  • Save todomodo/be661d7a3161b282355650458ecaea44 to your computer and use it in GitHub Desktop.

Select an option

Save todomodo/be661d7a3161b282355650458ecaea44 to your computer and use it in GitHub Desktop.
Hide YouTube doodle and replace with classic logo (Greasemonkey userscript)
// ==UserScript==
// @name classic_yt_button
// @namespace https://gist.github.com/todomodo/
// @description Replace YouTube doodle with the classic logo
// @include https://www.youtube.com/*
// @updateURL https://gist.githubusercontent.com/todomodo/be661d7a3161b282355650458ecaea44/raw/classic_yt_button.user.js
// @downloadURL https://gist.githubusercontent.com/todomodo/be661d7a3161b282355650458ecaea44/raw/classic_yt_button.user.js
// @version 2.2
// ==/UserScript==
// Inject CSS to hide doodle children and show static logo
var style = document.createElement('style');
style.textContent = [
'ytd-yoodle-renderer > * { display: none !important; }',
'ytd-yoodle-renderer {',
' background: url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 120 30\'%3E%3Crect x=\'0\' y=\'3\' width=\'28\' height=\'20\' rx=\'4\' fill=\'%23FF0000\'/%3E%3Cpolygon points=\'11,8 11,18 20,13\' fill=\'white\'/%3E%3Ctext x=\'32\' y=\'21\' font-family=\'Roboto,Arial,sans-serif\' font-size=\'20\' font-weight=\'600\' fill=\'%23282828\' letter-spacing=\'-0.8\'%3EYouTube%3C/text%3E%3C/svg%3E") no-repeat left center / contain !important;',
' min-width: 120px !important;',
' min-height: 24px !important;',
'}'
].join('\n');
document.head.appendChild(style);
// Strip title attributes to kill the doodle tooltip
function cleanYoodle() {
var yoodle = document.querySelector('ytd-yoodle-renderer');
if (!yoodle) return;
yoodle.removeAttribute('title');
yoodle.querySelectorAll('[title]').forEach(function(el) {
el.removeAttribute('title');
});
// strip title and enforce home link on parent elements
var el = yoodle.parentElement;
while (el && el.tagName !== 'BODY') {
if (el.hasAttribute('title')) el.removeAttribute('title');
if (el.tagName === 'A' && el.href !== 'https://www.youtube.com/') {
el.href = 'https://www.youtube.com/';
}
if (el.id === 'masthead' || el.tagName === 'YTD-MASTHEAD') break;
el = el.parentElement;
}
}
// MutationObserver catches YouTube re-adding the title
var observer = new MutationObserver(function(mutations) {
for (var i = 0; i < mutations.length; i++) {
var m = mutations[i];
if (m.type === 'attributes') {
var yoodle = document.querySelector('ytd-yoodle-renderer');
if (yoodle && (yoodle === m.target || yoodle.contains(m.target) ||
m.target.contains(yoodle))) {
if (m.attributeName === 'title') {
m.target.removeAttribute('title');
}
if (m.attributeName === 'href' && m.target.tagName === 'A') {
m.target.href = 'https://www.youtube.com/';
}
}
}
if (m.type === 'childList') {
cleanYoodle();
}
}
});
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ['title', 'href'],
childList: true,
subtree: true
});
// initial sweep
cleanYoodle();
var count = 0;
var intv = setInterval(function() {
cleanYoodle();
if (++count > 200) {
clearInterval(intv);
console.log('classic_yt_button: done (observer still active)');
}
}, 25);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment