您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
This code is intended solely for testing and improving existing functions. it has not been tested and is not recommended for actual use.
This is intended only for those who want to help improve the code and make it better.
GM_onMessage(label, callback)
Description:
Listens for messages sent via GM_sendMessage
. Executes callback
when a message with the matching label is received.
Parameters:
label
(string) – Message label/key.callback
(function, optional) – Function executed when a message is received. Receives the message value as an argument.Returns: Nothing.
GM_sendMessage(label, value)
Description:
Sends a message to other script contexts by setting a GM value. Works with GM_onMessage
.
Parameters:
label
(string) – Message label/key.value
(any) – Data to send.Returns: Nothing.
strBetween(str, start, end)
Description:
Extracts and returns the substring between start
and end
markers.
Parameters:
str
(string) – Source text.start
(string) – Starting delimiter.end
(string) – Ending delimiter.Returns: Substring (string) or empty string if not found.
Checkvisibility(elem)
Description: Checks if a DOM element is visible.
Parameters:
elem
(HTMLElement) – The element to check.Returns:
true
if visible, false
otherwise.
RSCookie(name, value, days)
Description: Get or set cookies.
Parameters:
name
(string) – Cookie name.value
(string, optional) – Value to set (if omitted, function reads the cookie).days
(number, optional) – Number of days until expiry (when setting).Returns:
setActiveElement(selector)
Description:
Finds an element by selector and focuses it, temporarily setting tabIndex
.
Parameters:
selector
(string) – CSS selector.Returns: Nothing.
captchaSolved(callback, onWait)
Description:
Detects when a CAPTCHA (IconCaptcha, hCaptcha, reCAPTCHA, or Cloudflare Turnstile) is solved and runs callback
.
Parameters:
callback
(function) – Executed once CAPTCHA is solved.onWait
(function, optional) – Called while waiting for CAPTCHA to be solved.Returns: Nothing.
httpListener(callback)
Description:
Intercepts all XMLHttpRequest
calls and triggers a callback when a request completes.
Parameters:
callback(xhr)
(function) – Receives the completed XHR object.Returns: Nothing.
waitForElement(selector, timeout)
Description: Waits until an element appears in the DOM (supports CSS selectors and XPath).
Parameters:
selector
(string) – CSS or XPath selector.timeout
(number, optional) – Max time to wait in seconds (default = infinite).Returns: Promise → Resolves with element or rejects on timeout.
openWithReferrerPolicy(href)
Description:
Opens a URL in the current page with Referrer-Policy: origin
.
Parameters:
href
(string) – URL to open.Returns: Nothing.
waitSec(s)
Description: Simple delay function.
Parameters:
s
(number) – Seconds to wait.Returns: Promise that resolves after given seconds.
expandRegex(str)
Description:
Expands regex patterns with groups (a|b|c)
into all possible strings.
Parameters:
str
(string) – Regex pattern string.Returns: Array of expanded strings.
runIfHost(pattern, fn, ...args)
Description:
Runs a function if the current hostname matches a regex pattern
.
Parameters:
pattern
(string) – Regex pattern.fn
(function) – Function to execute....args
– Arguments passed to fn
.Returns: Nothing.
goTo(url, useBlog)
Description:
Redirects browser to a URL, optionally wrapping it with blogURL
.
Parameters:
url
(string) – Destination URL.useBlog
(boolean, optional) – Whether to redirect via blogURL
.Returns: Nothing.
createGMLogger(options)
Description: Creates a logger with persistent GM storage.
Parameters:
options.maxLogs
(number, optional) – Max logs to store (default 200).options.gmKey
(string, optional) – GM storage key (default tm_logs
).Returns: Logger object with methods:
log
, info
, warn
, error
getLogs()
clearLogs()
elementRedirect(selector, attribute)
Description:
Waits for an element, extracts an attribute (e.g., href
), and redirects.
Parameters:
selector
(string) – CSS selector(s).attribute
(string, optional) – Attribute to redirect to (default href
).Returns: Nothing.
parameterRedirect(url, parameters)
Description: Redirects based on URL query parameters.
Parameters:
url
(string) – URL with parameter placeholder ($paramName
).parameters
(string) – Query parameter name required for redirect.Returns: Nothing.
referrerPolicy(key)
Description:
Opens a URL (from query param) with Referrer-Policy: origin
.
Parameters:
key
(string) – Query parameter name.Returns: Boolean – Whether policy was applied.
clickSel(selector, delay)
Description: Waits for an element and simulates a click (or form submit).
Parameters:
selector
(string) – CSS selector(s).delay
(number, optional) – Delay before clicking (seconds).Returns: Nothing.
redirectIfHost(pattern, selector, attribute)
→ Runs elementRedirect
if host matches.clickIfHost(pattern, selector)
→ Runs clickSel
if host matches.autoDownloadIfHost(pattern, fn, ...args)
→ Runs function if host matches and cfg.AutoDL
is enabled.clickAfterCaptcha(selector)
→ Clicks selector after CAPTCHA is solved.