阻擋 ps4id.cloud 點擊下載時強制廣告彈出並隱藏假下載按鈕

阻擋點擊 Download 時的廣告彈出,只開正常連結;隱藏廣告假按鈕

// ==UserScript==
// @name         阻擋 ps4id.cloud 點擊下載時強制廣告彈出並隱藏假下載按鈕
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  阻擋點擊 Download 時的廣告彈出,只開正常連結;隱藏廣告假按鈕
// @author       shanlan(grok-4-fast-reasoning)
// @match        https://ps4id.cloud/*
// @match        https://link.ps4id.cloud/*
// @grant        none
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // 攔截 poplink 點擊,防止廣告彈出
    document.addEventListener('click', function(e) {
        if (e.target.classList.contains('poplink')) {
            e.stopImmediatePropagation();
            e.preventDefault();
            window.open(e.target.href, '_blank');
        }
    }, true);

    // 隱藏 uploadquick.link 按鈕(使用 MutationObserver 監聽動態變化)
    const hideUploadQuick = () => {
        document.querySelectorAll('a[href*="uploadquick.link"]').forEach(el => {
            el.style.display = 'none';
        });
    };
    hideUploadQuick();  // 立即隱藏
    const observer = new MutationObserver(hideUploadQuick);
    observer.observe(document.body, { childList: true, subtree: true });  // 監聽 body 變化
})();