Remove Youtube Yoodle

Remove yoodles from youtube

  1. // ==UserScript==
  2. // @name Remove Youtube Yoodle
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Remove yoodles from youtube
  6. // @author Marcer_f
  7. // @license MIT
  8. // @match https://www.youtube.com/*
  9. // @grant none
  10. // @icon https://e7.pngegg.com/pngimages/268/71/png-clipart-adblock-plus-web-browser-ad-blocking-computer-icons-opera-hand-rectangle-thumbnail.png
  11. // ==/UserScript==
  12.  
  13.  
  14.  
  15. //Bugs:
  16. //no HD Youtube Logo (this will be adjustable later in the script)
  17. //alt Text is visibile
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. // URL of the static YouTube logo
  23. const staticLogoURL = 'https://i.ibb.co/mBhKRcp/frame-000-delay-0-04s.webp';
  24.  
  25. // Function to remove and replace specific elements
  26. function replaceLogo() {
  27. // Remove element with ID 'dismissible' and class 'style-scope ytd-statement-banner-renderer'
  28. const elementsToRemove = document.querySelectorAll('#dismissible.style-scope.ytd-statement-banner-renderer');
  29. elementsToRemove.forEach(element => {
  30. if (element) {
  31. element.remove();
  32. }
  33. });
  34.  
  35. // Replace animated logo with the static logo
  36. const images = document.querySelectorAll('img');
  37. images.forEach(img => {
  38. if (img.src.startsWith('https://www.gstatic.com/youtube/img/promos/')) {
  39. img.src = staticLogoURL;
  40. img.srcset = staticLogoURL; // Update srcset for responsive images
  41. }
  42. });
  43. }
  44.  
  45. // Initial run
  46. replaceLogo();
  47.  
  48. // Observe DOM changes
  49. const observer = new MutationObserver(() => {
  50. replaceLogo();
  51. });
  52.  
  53. observer.observe(document.body, {
  54. childList: true,
  55. subtree: true
  56. });
  57.  
  58. // Additional handling for dynamic content
  59. window.addEventListener('yt-navigate-finish', replaceLogo);
  60.  
  61. })();