Remove Youtube Propaganda

Tries to remove any banner and other dismissibles that are plain annoying (or straight up propaganda).

当前为 2023-03-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Remove Youtube Propaganda
  3. // @namespace https://github.com/Dwyriel
  4. // @version 1.3
  5. // @description Tries to remove any banner and other dismissibles that are plain annoying (or straight up propaganda).
  6. // @author Dwyriel
  7. // @license MIT
  8. // @match *://*.youtube.com/*
  9. // @grant none
  10. // @homepageURL https://github.com/Dwyriel/Greasyfork-Scripts
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. const idsToRemove = [
  16. "big-yoodle", //main page banner
  17. "clarify-box" //video page "clarification"
  18. ];
  19. const elementsToRemove = [
  20. "ytm-statement-banner-renderer", "ytd-statement-banner-renderer", //main page banner
  21. "ytm-clarification-renderer", "ytd-clarification-renderer", //search page "clarification" (specific topics only)
  22. "ytm-info-panel-container-renderer", "ytd-info-panel-container-renderer" //search page "clarification" (specific topics only)
  23. ];
  24. const callback = () => {
  25. for (let id of idsToRemove)
  26. document.getElementById(id)?.remove();
  27. for (let elementName of elementsToRemove) {
  28. let elements = document.getElementsByTagName(elementName);
  29. for (let element of elements)
  30. element.remove();
  31. }
  32. };
  33. const config = { attributes: true, childList: true, subtree: true };
  34. new MutationObserver(callback).observe(document.body, config);
  35. })();