Undetectorized

Keeps sites blind to tab switches and window blur. Fully blocks all focus and visibility checks.. like, waay more solid than the “Always On Focus” scripts. Btw Shoutout to daijro.

2025/11/21のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name          Undetectorized
// @namespace     bypass.focus.fixed
// @version       5.3
// @author        @DoesBadThingsGuy
// @icon          https://i.imgur.com/l8qT82q.jpeg
// @description   Keeps sites blind to tab switches and window blur. Fully blocks all focus and visibility checks.. like, waay more solid than the “Always On Focus” scripts. Btw Shoutout to daijro.
// @include       *
// @run-at        document-start
// ==/UserScript==

(function() {
    const uw = unsafeWindow;
    const patch = () => {
        try {
            uw.document.hasFocus = () => true;
            uw.hasFocus = () => true;
            Object.defineProperty(document, "visibilityState", { get: () => "visible" });
            ["hidden","mozHidden","msHidden","webkitHidden"].forEach(p =>
                Object.defineProperty(document, p, { value: false })
            );
            window.onblur = null;
            window.onfocus = null;
            document.onblur = null;
            document.onfocus = null;
            window.focus = () => true;
            document.focus = () => true;
            window.onbeforeunload = null;
            document.onbeforeunload = null;
            Object.defineProperty(window, "onbeforeunload", {
                set: () => true,
                get: () => null
            });
        } catch(e){}
    };

    const blockEvents = () => {
        try {
            const evs = [
                "visibilitychange","webkitvisibilitychange","mozvisibilitychange","msvisibilitychange",
                "blur","focus","focusin","focusout",
                "mouseleave","mouseout","mouseenter","mouseover",
                "pageshow","pagehide","resume","freeze"
            ];
            const handler = e => {
                e.stopImmediatePropagation();
                e.stopPropagation();
                e.preventDefault();
            };
            evs.forEach(ev => {
                window.addEventListener(ev, handler, true);
                document.addEventListener(ev, handler, true);
            });
        } catch(e){}
    };

    const hookAddEvent = () => {
        try {
            const blocked = [
                "visibilitychange","webkitvisibilitychange","mozvisibilitychange","msvisibilitychange",
                "blur","focus","focusin","focusout",
                "mouseleave","mouseout","mouseenter","mouseover",
                "beforeunload",
                "pageshow","pagehide","resume","freeze"
            ];
            const orig = EventTarget.prototype.addEventListener;
            EventTarget.prototype.addEventListener = function(type, listener, opts) {
                if (blocked.includes(type)) return;
                return orig.call(this, type, listener, opts);
            };
        } catch(e){}
    };

    const patchTiming = () => {
        try {
            const base = performance.now();
            performance.now = () => base + Math.random() * 0.01;
            const oRAF = uw.requestAnimationFrame;
            uw.requestAnimationFrame = cb => oRAF(() => cb(performance.now()));
            const oTO = uw.setTimeout;
            uw.setTimeout = (fn, t) => oTO(fn, 0);
        } catch(e){}
    };

    patch();
    blockEvents();
    hookAddEvent();
    patchTiming();

    setInterval(() => {
        patch();
        hookAddEvent();
        patchTiming();
    }, 100);

})();