您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
基于关键词实现的广告动态屏蔽
// ==UserScript== // @name B站广告动态屏蔽 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 基于关键词实现的广告动态屏蔽 // @author QingMu_ // @match https://t.bilibili.com/* // @icon https://static.hdslb.com/images/favicon.ico // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Your code here... const keywords = ["京东", "淘宝", "红包", "优惠", "划算", "特惠"] const observerConfig = {childList: true, subtree: true ,characterData:true ,attributes:true} const observer = new MutationObserver(blockBox); setTimeout(function(){ blockBox() observer.observe(document.querySelector(".bili-dyn-list"), observerConfig); },2000) function getTextBox() { return document.querySelectorAll(".bili-dyn-item__main") } function checkKeywords(text) { let flag = false keywords.forEach((item,index)=>{ if(text.indexOf(item) !== -1){ flag = true } }) return flag } function blockBox() { let boxs = getTextBox() boxs.forEach((item) => { if (checkKeywords(item.innerText)) { item.innerHTML="" } }) } })();