Greasy Fork

破解切屏检测

破解所有网站的切屏检测

目前为 2023-01-03 提交的版本。查看 最新版本

// ==UserScript==
// @name         破解切屏检测
// @namespace    http://tampermonkey.net/
// @version      0.1.0
// @description  破解所有网站的切屏检测
// @author       share121
// @match        *://*/*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    ["visibilitychange", "blur", "focus", "focusin", "focusout"].forEach(
        (a) => {
            [true, false].forEach((b) => {
                [window, document, document.documentElement, document.body].forEach((c) => {
                    c.addEventListener(
                        a,
                        (e) => {
                            e.stopImmediatePropagation && e.stopImmediatePropagation();
                            e.stopPropagation();
                            e.preventDefault();
                            return false;
                        },
                        b
                    );
                });
            });
        }
    );
})();