Sleazy Fork is available in English.
Fixes the display of avatars on YouTube
// ==UserScript==
// @name YouTube Avatars Fix
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Fixes the display of avatars on YouTube
// @author frz
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @match https://*.youtube.com/*
// @match https://studio.youtube.com/*
// @match https://yt3.googleusercontent.com/*
// @match https://yt4.ggpht.com/*
// @match https://yt4.googleusercontent.com/*
// @match https://vidiq.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
function fixAvatarUrl(url) {
if (!url) return url;
return url.replace(/yt3\.ggpht\.com/g, 'yt4.ggpht.com');
}
function fixImage(img) {
if (!img || !img.src) return;
const originalSrc = img.src;
if (originalSrc.includes('yt3.ggpht.com')) {
const newSrc = fixAvatarUrl(originalSrc);
if (newSrc !== originalSrc) {
img.src = newSrc;
}
}
}
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.addedNodes.length) {
mutation.addedNodes.forEach(node => {
if (node.nodeType === Node.ELEMENT_NODE) {
if (node.tagName === 'IMG') {
fixImage(node);
}
if (node.querySelectorAll) {
node.querySelectorAll('img[src*="yt3.ggpht.com"]').forEach(fixImage);
}
}
});
}
if (mutation.type === 'attributes' && mutation.attributeName === 'src') {
const target = mutation.target;
if (target.tagName === 'IMG') {
fixImage(target);
}
}
});
});
observer.observe(document.documentElement, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['src']
});
document.querySelectorAll('img[src*="yt3.ggpht.com"]').forEach(fixImage);
})();