Remove YouTube Adblock Message & Overlay

Removes YouTube's adblock warning by deleting ytd-popup-container and the overlay backdrop

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Remove YouTube Adblock Message & Overlay
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Removes YouTube's adblock warning by deleting ytd-popup-container and the overlay backdrop
// @author       drewby123
// @match        *://www.youtube.com/*
// @grant        none
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    const removeElements = () => {
        const popupContainer = document.querySelector('ytd-popup-container');
        const overlayBackdrop = document.querySelector('tp-yt-iron-overlay-backdrop');

        if (popupContainer) {
            popupContainer.remove();
            console.log('Removed ytd-popup-container');
        }

        if (overlayBackdrop) {
            overlayBackdrop.remove();
            console.log('Removed overlay backdrop');
        }
    };

    // Run initially
    removeElements();

    // Observe and re-run when elements are reinserted
    const observer = new MutationObserver(removeElements);

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();