Greasy Fork is available in English.
删除左侧的视屏广告
当前为
// ==UserScript==
// @name opgg去广告
// @namespace http://akiyamamio.online/
// @version 1.1
// @description 删除左侧的视屏广告
// @author alive
// @match https://*.op.gg/*
// @icon https://s-lol-web.op.gg/favicon.ico
// @license GPL-3.0-or-later
// @grant none
// @run-at document-end
// ==/UserScript==
(function () {
'use strict';
var LOL_IDS = [
"#opgg-video",
"#primisPlayerContainerDiv",
"#banner-container",
".vm-skin",
".vm-footer",
".eaw4xvd0",
".eaw4xvd1",
".eaw4xvd2",
".eaw4xvd3",
".eaw4xvd4",
".eaw4xvd5"
];
var TFT_IDS = [
"#vid-container0",
"#video-tools-ad",
".css-13lit7a",
".desktop",
".css-1t8t0it"
];
var V_IDS = [
"#video-leaderboards-ad",
"#video-stas-ad",
"#video-crosshair-ad",
"#video-agents-ad",
"#video-weapons-ad",
".ad"
];
// 合并所有ID数组
var allIDS = LOL_IDS.concat(TFT_IDS, V_IDS);
// 拼接选择器条件
var selector = allIDS.map(id => `#${id}`).join(', ');
// 观察DOM并自动隐藏
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
var elements = document.querySelectorAll(selector);
elements.forEach(function (element) {
if (element && element.style.display !== 'none') {
element.style.display = 'none';
console.log("清除视频");
}
});
});
});
observer.observe(document.body, {childList: true, subtree: true});
})();