Fuck YouTube Popup

Removes the annoying popup message about using an adblocker on YouTube.

Ekde 2024/06/24. Vidu La ĝisdata versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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            Fuck YouTube Popup
// @description     Removes the annoying popup message about using an adblocker on YouTube.
// @description:de  Entfernt die lästige Popup-Nachricht zur Verwendung eines Adblockers auf YouTube.
// @description:ru  Удаление всплывающего окна об использовании блокировщика рекламы на YouTube.
// @description:uk  Видалення спливаючого вікна про використання блокувальника реклами на YouTube.
// @description:zh  YouTube 广告拦截器弹出窗口移除器:移除 YouTube 上关于使用广告拦截器的烦人弹出窗口消息。
// @description:ja  YouTube広告ブロッカーポップアップリムーバー:YouTubeで広告ブロッカーを使用する際の迷惑なポップアップメッセージを除去します。
// @description:nl  YouTube Adblock Popup-verwijderaar: Verwijdert het vervelende pop-upbericht over het gebruik van een adblocker op YouTube.
// @description:pt  Removedor de pop-up de bloqueador de anúncios do YouTube: Remove a mensagem irritante de pop-up sobre o uso de um bloqueador de anúncios no YouTube.
// @description:es  Removedor de pop-up del bloqueador de anuncios de YouTube: Elimina el molesto mensaje emergente sobre el uso de un bloqueador de anuncios en YouTube.
// @description:it  Rimozione del popup del blocco pubblicità di YouTube: Rimuove il fastidioso messaggio popup sull'uso di un blocco pubblicità su YouTube.
// @description:ar  إزالة النافذة المنبثقة لمانع الإعلانات على يوتيوب: يزيل الرسالة المنبثقة المزعجة حول استخدام مانع الإعلانات على يوتيوب.
// @description:fr  Supprimeur de popup de bloqueur de publicités YouTube : Supprime le message pop-up ennuyeux sur l'utilisation d'un bloqueur de publicités sur YouTube.
// @namespace       https://greatest.deepsurf.us/users/1221433
// @icon            https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @author          Sitego
// @version         1.3
// @match           *://www.youtube.com/*
// @grant           none
// @license         MIT
// ==/UserScript==

(() => {
    'use strict';
    const a = ['www.youtube.com##tp-yt-paper-dialog.ytd-popup-container.style-scope','www.youtube.com##.opened','www.youtube.com##.ytd-app','youtube.com,youtubekids.com,youtube-nocookie.com#@#+js(json-prune, [].playerResponse.adPlacements [].playerResponse.playerAds playerResponse.adPlacements playerResponse.playerAds adPlacements playerAds)','youtube.com,youtubekids.com,youtube-nocookie.com##+js(json-prune, [].playerResponse.adPlacements [].playerResponse.playerAds)','youtube.com,youtubekids.com,youtube-nocookie.com##+js(json-prune, playerResponse.adPlacements playerResponse.playerAds adPlacements playerAds, playerConfig)','youtube.com,youtubekids.com,youtube-nocookie.com##+js(json-prune, auxiliaryUi.messageRenderers.enforcementMessageViewModel)','youtube.com,youtubekids.com,youtube-nocookie.com##+js(set, ytInitialPlayerResponse.auxiliaryUi.messageRenderers.enforcementMessageViewModel, undefined)','youtube.com##+js(set, yt.config_.openPopupConfig.supportedPopups.adBlockMessageViewModel, false)','youtube.com##+js(set, Object.prototype.adBlocksFound, 0)','youtube.com##+js(set, ytplayer.config.args.raw_player_response.adPlacements, [])','youtube.com##+js(set, Object.prototype.hasAllowedInstreamAd, true)'];
    a.forEach(a => {
        const b = document.createElement('style');
        b.textContent = a,
        document.head.appendChild(b)
    });
    let b = !1;
    const c = a => {
        a.addEventListener("click", a => {
            a.preventDefault(),
            a.stopPropagation(),
            a.stopImmediatePropagation(),
            b = !b
        }, !1),
        a.addEventListener("keydown", a => {
            a.preventDefault(),
            a.stopPropagation(),
            a.stopImmediatePropagation(),
            b = !b
        }, !1)
    },
    d = a => {
        a.removeEventListener("click", c, !1),
        a.removeEventListener("keydown", c, !1)
    };
    setInterval(() => {
        let a = document.querySelector("body > ytd-app > ytd-popup-container > .ytd-popup-container > ytd-enforcement-message-view-model");
        a && a.parentNode.remove();
        const e = document.querySelector("#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > button.ytp-play-button");
        if (e) {
            let a = e.getAttribute("data-title-no-tooltip"),
            f = "Play" == a;
            d(e),
            f && !b && (b = !f, e.click()),
            c(e)
        }
    }, 100)
})();