From e67297359afd60ef4020da91ea74c0d6b64f06c6 Mon Sep 17 00:00:00 2001 From: D4niloMR <70459964+D4niloMR@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:17:21 -0300 Subject: [PATCH] update trusted-replace-argument, prevent-setTimeout/prevent-setInterval, prevent-requestAnimationFrame documentation --- Resources-Library.md | 50 ++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/Resources-Library.md b/Resources-Library.md index 82f27a8..71c070e 100644 --- a/Resources-Library.md +++ b/Resources-Library.md @@ -32,8 +32,8 @@ - [trusted-set-local-storage-item](#trusted-set-local-storage-itemjs-) / trusted-set-session-storage-item [Trusted] - [remove-cache-storage-item](#remove-cache-storage-itemjs-) - [call-nothrow](#call-nothrowjs-) -- [no-setInterval-if](#no-setinterval-ifjs-) _(nosiif / prevent-setInterval / setInterval-defuser)_ -- [no-setTimeout-if](#no-settimeout-ifjs-) _(nostif / prevent-setTimeout / setTimeout-defuser)_ +- [prevent-setInterval](#prevent-setIntervaljs-) _(no-setInterval-if / nosiif / setInterval-defuser)_ +- [prevent-setTimeout](#prevent-setTimeoutjs-) _(no-setTimeout-if / nostif / setTimeout-defuser)_ - [adjust-setInterval](#adjust-setIntervaljs-) _(nano-setInterval-booster / nano-sib)_ - [adjust-setTimeout](#adjust-setTimeoutjs-) _(nano-setTimeout-booster / nano-stb)_ - [prevent-xhr](#prevent-xhrjs-) _(no-xhr-if)_ @@ -68,7 +68,7 @@ - [noeval-silent](#noeval-silentjs-) - [noeval-if](#noeval-ifjs-) _(prevent-eval-if)_ - [~no-floc~](#no-flocjs-) -- [no-requestAnimationFrame-if](#no-requestanimationframe-ifjs-) _(norafif / prevent-requestAnimationFrame)_ +- [prevent-requestAnimationFrame](#prevent-requestAnimationFramejs-) _(no-requestAnimationFrame-if / norafif)_ - [nowebrtc](#nowebrtcjs-) - [webrtc-if](#webrtc-ifjs-) - [window.name-defuser](#windowname-defuser-) @@ -843,22 +843,20 @@ Also see: New in [1.55.1b18](https://github.com/gorhill/uBlock/commit/34da372d7af0ca576b7063053d7966fdb04bdf9b) +Replace an argument passed to a method. + Syntax: -- `[...]##+js(trusted-replace-argument, fn, argpos, argval [,condition, pattern])` +- `[...]##+js(trusted-replace-argument, propChain, argposRaw, argraw [,condition, pattern])` Parameters: -- required, `fn`: is the function we want to proxy through an `apply` handler. - This can also be a class, in which case the scriptlet will proxy - through `construct` handler. At the moment, `fn` must exist at the - time the scriptlet executes. -- required, `argpos`: is the 0-based position of the argument we want to change -- required, `argval`: is the value we want to have for the argument -- the value - is interpreted the same way the value for `set-constant` is - interpreted. +- required, `propChain`: The property chain to the function which argument must be replaced when called. +- required, `argposRaw`: The zero-based position of the argument in the argument list. Use a negative number for a position relative to the last argument. +- required, `argraw`: The replacement value, validated using the same heuristic as with the `set-constant.js` scriptlet. + - If the replacement value matches `json:...`, the value will be the json-parsed string after `json:` + - If the replacement value matches `repl:/.../.../`, the target argument will be replaced according the regex-replacement directive following `repl:` [1.61.3b1](https://github.com/gorhill/uBlock/commit/adced29b5bd26165ca89c4562a048c7e73a667f6) Tokens: -- `condition, pattern`: is a vararg which tells the scriptlet to act - only if `pattern` is found in the argument to overwrite. +- `condition, pattern`: The replacement will occur only when pattern matches the target argument. Examples of usage: - `alliptvlinks.com##+js(trusted-replace-argument, MutationObserver, 0, noopFunc)` @@ -867,9 +865,9 @@ Examples of usage: *** -### no-requestAnimationFrame-if.js [↪](https://github.com/gorhill/uBlock/blob/1de0e820b87fdd3717b9f2653baaa7a934075055/assets/resources/scriptlets.js#L522) +### prevent-requestAnimationFrame.js [↪](https://github.com/gorhill/uBlock/blob/1de0e820b87fdd3717b9f2653baaa7a934075055/assets/resources/scriptlets.js#L522) +### no-requestAnimationFrame-if.js / ### norafif.js -### prevent-requestAnimationFrame.js New in [1.27.0](https://github.com/gorhill/uBlock/commit/1de0e820b87fdd3717b9f2653baaa7a934075055). @@ -883,7 +881,7 @@ requestAnimationFrame. Use with `/^/` parameter to defuse all calls unconditionally. -When used without parameters, will log calls to _`requestAnimationFrame()`_ to the console. +When used without parameters, will log calls to _`requestAnimationFrame()`_ to the logger. Examples: - `bloomberg.com##+js(norafif, paywall-inline-tout)` @@ -893,9 +891,9 @@ Also see: *** -### no-setInterval-if.js [↪](https://github.com/gorhill/uBlock/blob/8f3d8cde7a9de45695d2706087701df59553c01b/assets/resources/scriptlets.js#L701) +### prevent-setInterval.js [↪](https://github.com/gorhill/uBlock/blob/8f3d8cde7a9de45695d2706087701df59553c01b/assets/resources/scriptlets.js#L701) +### no-setInterval-if.js / ### nosiif.js / -### prevent-setInterval.js / ### setInterval-defuser.js New in [1.23.0](https://github.com/gorhill/uBlock/commit/9367a6015b8cbb6b49347b00a105aab8f24df861) @@ -906,7 +904,10 @@ New in [1.23.0](https://github.com/gorhill/uBlock/commit/9367a6015b8cbb6b49347b0 Parameters: - optional, string/_regular expression_, matching in stringified callback function - - optional, decimal integer or literal `NaN` ("not a number", new in [1.28.2](https://github.com/gorhill/uBlock/commit/8f3d8cde7a9de45695d2706087701df59553c01b)), matching _interval_ + - optional, a value to match against the delay. Can be a single value for exact match, or a range: + - `min-max`: matches if delay >= min and delay <= max + - `min-`: matches if delay >= min + - `-max`: matches if delay <= max Use with `/^/` parameter to defuse all calls unconditionally. @@ -922,9 +923,9 @@ Also see: *** -### no-setTimeout-if.js [↪](https://github.com/gorhill/uBlock/blob/8f3d8cde7a9de45695d2706087701df59553c01b/assets/resources/scriptlets.js#L776) +### prevent-setTimeout.js [↪](https://github.com/gorhill/uBlock/blob/8f3d8cde7a9de45695d2706087701df59553c01b/assets/resources/scriptlets.js#L776) +### no-setTimeout-if.js / ### nostif.js / -### prevent-setTimeout.js / ### setTimeout-defuser.js New in [1.23.0](https://github.com/gorhill/uBlock/commit/9367a6015b8cbb6b49347b00a105aab8f24df861) @@ -935,7 +936,10 @@ New in [1.23.0](https://github.com/gorhill/uBlock/commit/9367a6015b8cbb6b49347b0 Parameters: - optional, string/_regular expression_, matching in stringified callback function - - optional, decimal integer or literal `NaN` ("not a number", new in [1.28.2](https://github.com/gorhill/uBlock/commit/8f3d8cde7a9de45695d2706087701df59553c01b)), matching _delay_ + - optional, a value to match against the delay. Can be a single value for exact match, or a range: + - `min-max`: matches if delay >= min and delay <= max + - `min-`: matches if delay >= min + - `-max`: matches if delay <= max Use with `/^/` parameter to defuse all calls unconditionally.