Skip to content

Instantly share code, notes, and snippets.

@hguandl
Created July 16, 2021 12:55
Show Gist options
  • Save hguandl/6be16cbaccf3182625ff7dc217d71a5e to your computer and use it in GitHub Desktop.
Save hguandl/6be16cbaccf3182625ff7dc217d71a5e to your computer and use it in GitHub Desktop.
删除哔哩哔哩直播中的新版直播间相关内容
// ==UserScript==
// @name Bilibili New Live Cleaner
// @namespace https://hguandl.com
// @version 0.1
// @description 删除哔哩哔哩直播中的新版直播间相关内容
// @author hguandl
// @match *://link.bilibili.com/p/center/index*
// @icon https://www.bilibili.com/favicon.ico
// @grant none
// ==/UserScript==
(function() {
'use strict';
const newLiveClasses = ['check-pop-mask', // 弹窗遮罩层
'new-live-title', // 新版直播间标题
'open-new-live']; // 新版直播间标签
const hideClasses = (className) => {
const elements = document.getElementsByClassName(className);
for (const e of elements) {
e.style.display = "none";
}
};
const domOb = new MutationObserver(function(_, domOb) {
const popUp = document.getElementById('check-pop'); // 定位弹窗
if (popUp) {
const attrOb = new MutationObserver(function(_, attrOb) {
popUp.style.display = "none";
newLiveClasses.forEach(hideClasses);
});
attrOb.observe(popUp, { attributes: true });
}
});
domOb.observe(document, {
childList: true,
subtree: true
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment