Greasy Fork

Greasy Fork is available in English.

MioBt去广告

MioBT去除页面广告

当前为 2023-12-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MioBt去广告
// @namespace    http://tampermonkey.net/
// @version      1.0.4
// @description  MioBT去除页面广告
// @author       montaro2014
// @license      MIT
// @match        http://www.miobt.com/*
// @match        https://www.miobt.com/*
// @icon         https://www.google.com/s2/favicons?domain=miobt.com
// @grant        GM_addStyle
// ==/UserScript==
(function () {

    function hideAd() {
        GM_addStyle(".clear.text_center:nth-first{display:none;}");
    }

    hideAd();

    var querySelector = document.querySelector;
    var querySelectorAll = document.querySelectorAll;

    function removeAd() {
        var selectors = [
            ".gg_canvas",
            ".c1 .box:nth-child(2)",
            ".c1 .box:nth-child(2)",
            ".c1 .box:nth-child(2)",
            ".c1 .box:nth-child(2)"
        ];
        for (var selector of selectors) {
            removeBySelector(selector);
        }
    }
    var target = document.body;
    var observer = new MutationObserver(function (e) {
        removeAd(e);
    });
    var observerConfig = {
        childList: true,
        subtree: true
    }
    observer.observe(target, observerConfig);

    function removeBySelector(selector) {
        var doms = querySelectorAll.call(document, selector);
        if (doms.length > 0) {
            for (var dom of doms) {
                dom && dom.remove();
            }
        }
    }
    window.addEventListener("DOMContentLoaded", function () {
        removeAd();
    })
    window.addEventListener("scroll", function () {
        removeAd();
    })
    removeAd();

})();