您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Just Kill TieBa AD
当前为
- // ==UserScript==
- // @name Kill TieBa AD
- // @name:zh 贴吧伪装广告清理
- // @namespace hoothin
- // @version 0.4
- // @description Just Kill TieBa AD
- // @description:zh 清理ADB与ADP未能清理掉的百度贴吧列表伪装广告、帖内伪装广告与推荐应用广告
- // @author hoothin
- // @include http*://tieba.baidu.com/*
- // @grant none
- // @run-at document-body
- // @supportURL http://www.hoothin.com
- // @license MIT License
- // @compatible chrome
- // @compatible firefox
- // ==/UserScript==
- (function() {
- 'use strict';
- var observer, option;
- var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
- var tcss = ".j_encourage_entry{display: none !important;} .encourage_entry{display: none !important;}";
- var snod = document.createElement('style');
- snod.innerHTML = tcss;
- document.getElementsByTagName("head")[0].appendChild(snod);
- var content = document.querySelector("#content");
- if(content){
- observer = new MutationObserver(function(records){
- delAD("#thread_list","LI");
- });
- option = {
- 'childList': true,
- 'subtree': true
- };
- observer.observe(content, option);
- }else{
- content=document.querySelector(".content");
- if(!content)return;
- observer = new MutationObserver(function(records){
- delAD("#j_p_postlist","DIV");
- });
- option = {
- 'childList': true,
- 'subtree': true
- };
- observer.observe(content, option);
- }
- function delAD(a,b){
- var threadList = document.querySelector(a);
- if(!threadList) return;
- var delList = [];
- for(let thread of threadList.childNodes){
- if(thread.tagName == "STYLE"){
- delList.push(thread);
- var previousSibling = thread.previousSibling;
- previousSibling = previousSibling.tagName == b?previousSibling:previousSibling.previousSibling;
- delList.push(previousSibling);
- }else if(thread.getAttribute && thread.getAttribute("data-isautoreply")){
- delList.push(thread);
- }
- }
- for(let del of delList){
- threadList.removeChild(del);
- }
- }
- })();