LauncherLeaks Popup & Scroll Fix

Block popups and restore scrolling on LauncherLeaks.net

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         LauncherLeaks Popup & Scroll Fix
// @namespace    https://launcherleaks.net/
// @version      1.1
// @description  Block popups and restore scrolling on LauncherLeaks.net
// @author       You
// @match        https://launcherleaks.net/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';

    // Block window.open to stop popup windows
    window.open = function () {
        console.log('🛑 Blocked window.open');
        return null;
    };

    // Unlock scrolling by resetting overflow styles
    function unlockScroll() {
        document.documentElement.style.overflow = 'auto';
        document.body.style.overflow = 'auto';
    }

    // Remove common popup overlays
    function removeOverlays() {
        const selectors = [
            '.swal2-container',  // SweetAlert modal
            '.swal2-popup',
            '.modal-backdrop',
            '.popup', 
            '.overlay',
            '#popup',
            '.blocker'
        ];

        selectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => el.remove());
        });

        unlockScroll();
    }

    // Observe for new popups and fix scroll
    const observer = new MutationObserver(() => {
        removeOverlays();
    });

    window.addEventListener('load', () => {
        removeOverlays();
        observer.observe(document.body, { childList: true, subtree: true });
    });

})();