douyu ad block

斗鱼广告屏蔽 douyu ad block

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         douyu ad block
// @namespace    http://tampermonkey.net/
// @version      2025-09-22
// @description  斗鱼广告屏蔽 douyu ad block
// @author       wumail
// @match        https://www.douyu.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=douyu.com
// @grant        none
// @license      MIT
// ==/UserScript==
 
(function () {
    'use strict';
    function deleteElement(tag){
        const fn = (timer) => {
            const target = document.querySelectorAll(tag)

            if (target.length) {
                try{
                    clearInterval(timer)
                    for (let i = 0; i < target.length; i++) {
                        target[i].remove()
                    }
                }catch(error) {
                    console.error("!!")
                }
            }
        }
        let count = 50;
        let timer = setInterval(() => {
            if(count <= 0){
                clearInterval(timer)
            }
            fn(timer)
            count--
            console.log(count)
        }, 200)
        }
    window.addEventListener("load", (event) => {
        const elementsToDelete = [
            ".layout-Main > .layout-Banner",
            "#root > .bc-wrapper",
            ".layout-Main > #js-room-top-banner",
            "#js-room-activity",
            ".Title-ad",
            "#webmActKefuWeidget",
            ".IconCardAdBoundsBox",
            ".RechangeJulyPopups",
            ".aside-top-uspension-video-box  ",
            ".layout-Player-asideTopSuspension",
            ".Game",
            ".Video",
            ".room-top-banner-box",
            ".activeContainer__8Qxzw",
            ".werbungContainer__2sv7h",
            ".layout-Aside"
        ]

        elementsToDelete.forEach(ele => {
            const tag = ele
            deleteElement(tag)
        })
    });
})();