JUST TESTING CODE

try to take over the world!

Maker
JustOlaf
Dagelijks aantal installaties
1
Totaal aantal installaties
3
Beoordelingen
1 0 0
Versie
20
Gemaakt op
16-08-2025
Bijgewerkt op
21-08-2025
Grootte
80,8 KB
Licentie
N.v.t.
Wordt toegepast op
Alle websites

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.

If you are testing the new code and notice anything not working properly, please send me a link for review.


📄 Documentation for Utility Functions


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:

  • (boolean) when setting cookie.
  • (string|null) when reading cookie.

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.


Helper Aliases

  • 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.

长期地址
遇到问题?请前往 GitHub 提 Issues。