Remove YouTube Adblock Message & Overlay

Removes YouTube's adblock warning and the dark overlay backdrop

当前为 2025-06-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Remove YouTube Adblock Message & Overlay
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Removes YouTube's adblock warning and the dark overlay backdrop
  6. // @author drewby123
  7. // @match *://www.youtube.com/*
  8. // @grant none
  9. // @run-at document-idle
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. const removeElements = () => {
  17. const enforcementMessage = document.querySelector('ytd-enforcement-message-view-model');
  18. const overlayBackdrop = document.querySelector('tp-yt-iron-overlay-backdrop');
  19.  
  20. if (enforcementMessage) {
  21. enforcementMessage.remove();
  22. console.log('Removed enforcement message');
  23. }
  24.  
  25. if (overlayBackdrop) {
  26. overlayBackdrop.remove();
  27. console.log('Removed overlay backdrop');
  28. }
  29. };
  30.  
  31. // Run initially
  32. removeElements();
  33.  
  34. // Keep watching for new insertions
  35. const observer = new MutationObserver(() => {
  36. removeElements();
  37. });
  38.  
  39. observer.observe(document.body, {
  40. childList: true,
  41. subtree: true
  42. });
  43. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址