您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Force pages to always think the tab is visible/focused; optionally spoofs mouse as always "in page" and blocks exit/enter intent; shows a tiny popup when a visibility or mouse check is detected
this userscript forces all websites to always think the tab is visible and focused. it blocks or rewrites all known methods that pages use to detect tab visibility or focus state, and optionally notifies you when those checks happen.
document.visibilityState
→ always returns "visible"
document.hidden
→ always returns false
webkitVisibilityState
, mozHidden
, msHidden
, etc. → overridden the same waydocument.hasFocus()
→ always returns true
visibilitychange
, webkitvisibilitychange
, mozvisibilitychange
, msvisibilitychange
pagehide
, pageshow
, freeze
, resume
focus
/ blur
events (configurable to reduce noise)when a site tries to attach an event listener, the script wraps the handler so it always sees the document as visible.
CONFIG
object:
properties
: notify when visibility properties are readhasFocusCall
: notify when document.hasFocus()
is calledaddListener
: notify when a site registers an event listenerinvoke
: notify when a wrapped event listener is invokedsuppressFocusOnEditable
: prevents noisy popups when typing in inputs/textarea/contenteditableObject.defineProperty
to lock down visibility state valuesdocument-start
so it applies before most site scripts@all-frames true
)you can use these two websites to check if the userscript is working: