您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Some website detects user switching to other tabs, which can be disabled by this script. 有些网站会检测用户正处于后台,此脚本可以干掉这些检测。
// ==UserScript== // @name Disable Inavtive Detection (禁止后台检测) // @namespace https://ipidkun.com/ // @version 20241105.1 // @description Some website detects user switching to other tabs, which can be disabled by this script. 有些网站会检测用户正处于后台,此脚本可以干掉这些检测。 // @author ipid // @match *://*/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @run-at document-start // @license MIT // ==/UserScript== (function () { "use strict"; function pinValue(obj, key, value) { try { Object.defineProperty(obj, key, { enumerable: false, configurable: false, get: () => { return value; }, set: () => {}, }); } catch {} } function pinMethodReturnValue(obj, method, value) { try { obj[method] = () => value; } catch {} } function disableEvent(eventTarget, name) { try { eventTarget.addEventListener( name, (ev) => { try { ev.preventDefault(); } catch {} try { ev.stopImmediatePropagation(); } catch {} }, { capture: true, passive: false } ); } catch {} } pinValue(document, "hidden", false); pinValue(document, "webkitHidden", false); pinValue(document, "visibilityState", "visible"); pinValue(document, "webkitVisibilityState", "visible"); disableEvent(window, "blur"); disableEvent(window, "pagehide"); disableEvent(document, "visibilitychange"); pinMethodReturnValue(document, "hasFocus", true); })();