Greasy Fork is available in English.
bilibili,B站,屏蔽首页小火箭推广视频,屏蔽广告
当前为
// ==UserScript==
// @name 去你妈的批站诈骗广告
// @namespace http://tampermonkey.net/
// @version 1.2
// @description bilibili,B站,屏蔽首页小火箭推广视频,屏蔽广告
// @author 爆菊大师
// @match *://*.bilibili.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
function checkPseudoElements() {
document.querySelectorAll('.bili-video-card.is-rcmd').forEach(card => {
if (isBlocked(card) || Array.from(card.children).some(isBlocked)) {
card.style.display = 'none';
}
});
}
function isBlocked(element) {
const content = window.getComputedStyle(element, '::before').content;
return content.includes('该内容被AdGuard/AdBlock类插件屏蔽') ||
content.includes('该内容被AdBlock类插件屏蔽');
}
function checkIcons() {
const imageLinks = document.querySelectorAll('.bili-video-card__image--link');
imageLinks.forEach((link) => {
const targetIcon = link.querySelector('.vui_icon.bili-video-card__stats--icon');
if (targetIcon) {
link.closest('.bili-video-card').style.display = 'none';
}
});
}
checkPseudoElements();
checkIcons();
const observer = new MutationObserver(() => {
checkPseudoElements();
checkIcons();
});
observer.observe(document.body, { childList: true, subtree: true });
})();