Greasy Fork is available in English.
bilibili,B站 屏蔽首页小火箭推广广告
当前为
// ==UserScript==
// @name 去你妈的批站诈骗广告
// @namespace http://tampermonkey.net/
// @version 1.0
// @description bilibili,B站 屏蔽首页小火箭推广广告
// @author 爆菊大师
// @match *://*.bilibili.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
function checkPseudoElements() {
const cards = document.querySelectorAll('.bili-video-card.is-rcmd');
cards.forEach((card) => {
const beforeContent = window.getComputedStyle(card, '::before').content;
const afterContent = window.getComputedStyle(card, '::after').content;
if (
beforeContent.includes('该内容被AdGuard/AdBlock类插件屏蔽') ||
afterContent.includes('请检查插件以恢复正常内容展示')
) {
card.style.display = 'none';
return;
}
const children = card.children;
for (let child of children) {
const childBeforeContent = window.getComputedStyle(child, '::before').content;
if (childBeforeContent.includes('该内容被AdGuard/AdBlock类插件屏蔽')) {
card.style.display = 'none';
break;
}
}
});
}
checkPseudoElements();
const observer = new MutationObserver(() => {
checkPseudoElements();
});
observer.observe(document.body, { childList: true, subtree: true });
})();