🏠 返回首頁 

Greasy Fork is available in English.

屏蔽B站浏览器插件提示横幅与大会员图标

Hide elements with class "vip-wrap" and "adblock-tips"

// ==UserScript==
// @name         屏蔽B站浏览器插件提示横幅与大会员图标
// @namespace    http://tampermonkey.net/
// @version      2.5
// @description  Hide elements with class "vip-wrap" and "adblock-tips"
// @author       ChatGPT
// @match        http://*.bilibili.com/*
// @match        https://*.bilibili.com/*
// @license      MIT
// @grant        none
// ==/UserScript==
(function() {
'use strict';
function hideElements() {
let hideList = ["vip-wrap", "adblock-tips"];
for (let i = 0; i < hideList.length; i++) {
let elements = document.getElementsByClassName(hideList[i]);
for (let j = 0; j < elements.length; j++) {
if (elements[j]) {
elements[j].style.display = "none";
}
}
}
}
function observeDOM() {
const observer = new MutationObserver(function(mutationsList) {
for (let mutation of mutationsList) {
if (mutation.type === 'childList') {
hideElements();
}
}
});
observer.observe(document.body, { childList: true, subtree: true });
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', observeDOM);
} else {
observeDOM();
}
})();