ixkw去广告

去除星空影视(https://ixkw.cc/)两侧及右下角广告

// ==UserScript==
// @name         ixkw去广告
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  去除星空影视(https://ixkw.cc/)两侧及右下角广告
// @author       You
// @match        https://ixkw.cc/*
// @match        https://ixkw.top/*
// @match        https://ixkw.tv/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=ixkw.cc
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 动态注入CSS, 优先隐藏目标元素
    const style = document.createElement('style');
    style.textContent = `
    divz, [id$="left"], [id$="right"], #d_pnftkd, #d_xlwghj {
    display: none !important;
    }
    `;
    document.head.appendChild(style);

    // 精确处理:等待页面加载后确保隐藏
    window.addEventListener('load', function() {
        const divz = document.getElementsByTagName('divz');
        Array.from(divz).forEach(ele => {
            ele.style.display = 'none';
        })
        const left = document.querySelectorAll('[id$=left]');
        left.forEach(ele => {
            ele.style.display = 'none';
        })
        const right = document.querySelectorAll('[id$=right]');
        right.forEach(ele => {
            ele.style.display = 'none';
        })
    })
})();