mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Updated Resources Library (markdown)
parent
9975db583c
commit
3e8a72ba77
1 changed files with 25 additions and 12 deletions
|
|
@ -474,8 +474,8 @@ Parameters:
|
|||
(as with [`json-prune`](#json-prunejs-))
|
||||
|
||||
Varargs:
|
||||
- `dontOverwrite, 1`: do not modify the target inbound object.
|
||||
- `stackToMatch`: string or regular expression that must match the current function call stack trace. Prepend pattern with `!` to test for unmatched patterns in stack trace.
|
||||
- `, dontOverwrite, 1`: do not modify the target inbound object
|
||||
|
||||
Examples:
|
||||
|
||||
|
|
@ -851,17 +851,26 @@ Syntax:
|
|||
|
||||
Parameters:
|
||||
- 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, `argposRaw`: The zero-based position of the argument in the argument list. Use a negative number for a position relative to the last argument. Use literal `this` to replace the value used in `prototype`-based methods.
|
||||
- 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:` <sup>[1.61.3b1](https://github.com/gorhill/uBlock/commit/adced29b5bd26165ca89c4562a048c7e73a667f6)<sup>
|
||||
|
||||
If `argposRaw` parameter is not declared, the scriptlet will log all calls to `propChain` along with the arguments passed and will not replace the argument passed to the trapped method.
|
||||
|
||||
Tokens:
|
||||
- `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)`
|
||||
- `scimagojr.com##+js(trusted-replace-argument, document.querySelector, 0, json:"body", condition, .ad-zone)`
|
||||
- `example.com##+js(trusted-replace-argument, String.prototype.split, this, repl:/&ads=1/&ads=0/, condition, ads_enabled=true)`
|
||||
- For illustration, this filter will intercept `String.prototype.split` method and regex-replace the string before the string is split, see example below.
|
||||
- ```
|
||||
var config = "ads_enabled=true&ads=1";
|
||||
config.split("&");
|
||||
// &ads=1 will be replaced with &ads=0
|
||||
```
|
||||
|
||||
|
||||
***
|
||||
|
|
@ -1065,13 +1074,17 @@ Parameters:
|
|||
- optional, value: The new value of the attribute. Since the scriptlet requires a trusted source, the value can be anything.
|
||||
|
||||
Examples:
|
||||
```adblock
|
||||
example.com##+js(trusted-set-attr, body, class, some-class)
|
||||
example.com##+js(trusted-set-attr, body, test-attribute, '[true, true]')
|
||||
```
|
||||
1. Adds a `class` attribute to the body element with the value `some-class`.
|
||||
|
||||
1. Adds a "class" attribute to the body element with the value "some-class".
|
||||
2. Adds a "test-attribute" attribute to the body element with the value "[true, true]".
|
||||
```adblock
|
||||
example.com##+js(trusted-set-attr, body, class, some-class)
|
||||
```
|
||||
|
||||
2. Adds a `test-attribute` attribute to the body element with the value `[true, true]`.
|
||||
|
||||
```adblock
|
||||
example.com##+js(trusted-set-attr, body, test-attribute, '[true, true]')
|
||||
```
|
||||
|
||||
Also see:
|
||||
- [AdGuard `trusted-set-attr`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#-%EF%B8%8F-trusted-set-attr)
|
||||
|
|
@ -1461,10 +1474,9 @@ New in [1.58.1rc0](https://github.com/gorhill/uBlock/commit/97d11c03c2)
|
|||
|
||||
This is a first draft version with current limitations:
|
||||
- Does not support matching arguments which are object or array
|
||||
- Does not support `stack` parameter
|
||||
|
||||
Syntax:
|
||||
- `example.org#%#//scriptlet('trusted-suppress-native-method', methodPath, signatureStr[, how[, stack]])`
|
||||
- `example.org##+js(trusted-suppress-native-method, methodPath, signatureStr[, how[, stack]])`
|
||||
|
||||
Parameters:
|
||||
- methodPath – required, string path to a native method (joined with `.` if needed). The property must be attached to `window`.
|
||||
|
|
@ -1485,7 +1497,9 @@ Tokens:
|
|||
- `debug` – triggers a `debugger` statement and the target
|
||||
method is not suppressed. Useful to find out how the method is
|
||||
being called by the page's code.
|
||||
- "stack": optional, string or regular expression that must match the current function call stack trace.
|
||||
- "stack": optional, string or regular expression that must match the current function call stack trace. Prepend pattern with `!` to test for unmatched patterns in stack trace.
|
||||
|
||||
The scriptlet will log stack trace in uBO's logger when verbose mode is enabled.
|
||||
|
||||
Examples:
|
||||
|
||||
|
|
@ -1587,7 +1601,6 @@ Parameters:
|
|||
- `on`<sup>1</sup> / `off`<sup>1</sup>,
|
||||
- `true` / `t`<sup>3</sup> / `false` / `f`<sup>3</sup>,
|
||||
- `yes` / `y` / `no` / `n`
|
||||
|
||||
- optional, cookie path, defaults to /; possible values:
|
||||
- `/`: root path
|
||||
- `none`: to set no path at all
|
||||
|
|
|
|||
Loading…
Reference in a new issue