Remove Disable Adblock Nag Screen on 1mov.lol

Automatically removes the Disable Ads Blocker nag screen overlays on 1mov.lol

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Remove Disable Adblock Nag Screen on 1mov.lol 
// @version      1.5
// @description  Automatically removes the Disable Ads Blocker nag screen overlays on 1mov.lol
// @author       https://greasyfork.org/en/users/567951-stuart-saddler, but the overlay removal logic is based on the "Behind the Overlay" extension by NicolaeNMV (https://github.com/NicolaeNMV/BehindTheOverlay)
// @icon         https://1mov.lol/wp-content/uploads/2024/07/cropped-logo.png
// @match        https://1mov.lol/*
// @license      MIT
// @namespace    https://greasyfork.org/users/567951
// ==/UserScript==

(function() {
    'use strict';

    // Function to identify and remove overlays, excluding login-related elements and season/episode selectors
    function removeStubbornOverlays() {
        // Select all elements
        const elements = document.querySelectorAll('*');

        elements.forEach(element => {
            const style = window.getComputedStyle(element);
            const zIndex = parseInt(style.zIndex, 10);
            const textContent = element.textContent.toLowerCase();
            const className = element.className.toLowerCase();
            const id = element.id.toLowerCase();

            // Keywords to identify login-related elements to exclude
            const loginKeywords = ['login', 'sign in', 'register', 'sign up', 'sign out', 'logout'];

            // Keywords to identify season and episode dropdowns to exclude
            const seasonEpisodeKeywords = ['episodes', 'season', 'tv'];

            // Check if the element matches any login-related or season/episode keyword in its text, class, or ID
            const isLoginRelated = loginKeywords.some(keyword =>
                textContent.includes(keyword) || className.includes(keyword) || id.includes(keyword)
            );
            
            const isSeasonEpisodeRelated = seasonEpisodeKeywords.some(keyword =>
                textContent.includes(keyword) || className.includes(keyword) || id.includes(keyword)
            );

            // Remove overlays if they're not login-related or season/episode-related, and if position is fixed or absolute and z-index is high
            if ((style.position === 'fixed' || style.position === 'absolute') && zIndex > 999 && !isLoginRelated && !isSeasonEpisodeRelated) {
                element.remove();  // Remove the overlay
            }
        });

        // Additional removal of elements with overlay-specific IDs or classes, but still exclude login and season/episode elements
        const specificOverlays = ['#modal-overlay', '.modal-backdrop', '.popup-overlay', '#full-screen-overlay'];
        specificOverlays.forEach(selector => {
            const overlays = document.querySelectorAll(selector);
            overlays.forEach(overlay => {
                const textContent = overlay.textContent.toLowerCase();
                const className = overlay.className.toLowerCase();
                const id = overlay.id.toLowerCase();
                const isLoginRelated = loginKeywords.some(keyword =>
                    textContent.includes(keyword) || className.includes(keyword) || id.includes(keyword)
                );
                const isSeasonEpisodeRelated = seasonEpisodeKeywords.some(keyword =>
                    textContent.includes(keyword) || className.includes(keyword) || id.includes(keyword)
                );
                if (!isLoginRelated && !isSeasonEpisodeRelated) {
                    overlay.remove();
                }
            });
        });
    }

    // Initial removal of existing overlays
    removeStubbornOverlays();

    // Use MutationObserver to detect dynamically added overlays and remove them
    const observer = new MutationObserver(() => {
        removeStubbornOverlays();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();