opgg去广告

删除左侧的视屏广告

目前为 2024-08-27 提交的版本。查看 最新版本

// ==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
// ==/UserScript==

(function () {
    'use strict';
    var LOL_IDS = [
        "opgg-video",
        "primisPlayerContainerDiv"
    ];
    var TFT_IDS = ["vid-container0","video-tools-ad"];
    var V_IDS = [
        "video-leaderboards-ad",
        "video-stas-ad",
        "video-crosshair-ad",
        "video-agents-ad",
        "video-weapons-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});
})();





QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址