// ==UserScript== // @name 贴吧广告过滤登录去除 // @namespace noting // @version 0.6 // @description 贴吧广告过滤不用登录 // @author Time // @match https://tieba.baidu.com/* // @grant none // @downloadURL none // ==/UserScript== (function() { var options = { matching: "tieba.baidu.com", loginDom: "tiebaCustomPassLogin", avdDom: "fengchao-wrap-feed", avdTextClass: "label_text", avdText: "广告", }; var host = window.location.host; if (host.indexOf(options.matching) == -1) return; var clearLogin = function() { var login = document.getElementById(options.loginDom); if (login == null) return; login.remove(); }; var clearAdvertisement = function() { var classAdv = document.getElementsByClassName(options.avdDom); if (classAdv.length > 0) { for (var i = 0; i < classAdv.length; i++) { classAdv[i].remove(); } } var classAvdText = document.getElementsByClassName(options.avdTextClass); if (classAvdText.length > 0) { for (var i = 0; i < classAvdText.length; i++) { if (classAvdText[i].innerText == options.avdText) { try{ var parentfather = classAvdText.parentNode.parentNode; parentfather.removeChild(parentfather); }catch{console.log(classAvdText[i])} } } } }; setInterval(function() { clearLogin(); clearAdvertisement(); }, 300); })();