// ==UserScript== // @name opgg去广告 // @namespace http://akiyamamio.online/ // @version 1.0 // @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 // @downloadURL none // ==/UserScript== (function () { 'use strict'; var LOL_IDS = [ "#opgg-video", "#primisPlayerContainerDiv", "#banner-container", ".vm-skin", ".vm-footer", ".eaw4xvd1" ]; var TFT_IDS = [ "#vid-container0", "#video-tools-ad", ".css-13lit7a", ".desktop" ]; 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}); })();