// ==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 // @downloadURL none // ==/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(); })();