diff --git a/Resources-Library.md b/Resources-Library.md index d537ee7..68f29fc 100644 --- a/Resources-Library.md +++ b/Resources-Library.md @@ -653,19 +653,31 @@ Parameters: - optional, space-separated list of conditions which must be ALL fulfilled in order for the defusing to take place: - string/_regular expression_, prefixed by `!` for negation (new in [1.59.1b13](https://github.com/gorhill/uBlock/commit/e8202af11d)), matching in URL passed to `fetch()` call - colon-separated `name:value` pairs of [`init` option name](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters) and string/_regular expression_ matching in value of that option passed to `fetch()` call. + - optional, arguments to define the response body, possible values: + - `true` to randomize the response, random 10-character string [1.51.1b15](https://github.com/gorhill/uBlock/commit/418087d) + - `emptyObj` to return the response value as empty object [1.54.1rc2](https://github.com/gorhill/uBlock/commit/e1ae17e) + - `emptyArr` to return the response value as empty array [1.54.1rc2](https://github.com/gorhill/uBlock/commit/e1ae17e) + - `emptyStr` to return the response value as empty string [1.54.1rc2](https://github.com/gorhill/uBlock/commit/e1ae17e) + - `length:min[-max]` to fulfill the response with randomized text with length specified, limited to 500000 characters [1.54.1b1](https://github.com/gorhill/uBlock/commit/6aeab2a) + - `war:[name of resource]` to fulfill the response with the content of a [web_accessible_resources](https://github.com/gorhill/uBlock/tree/master/src/web_accessible_resources) resource [1.54.1b1](https://github.com/gorhill/uBlock/commit/6aeab2a) - optional, (new in [1.58.1rc4](https://github.com/gorhill/uBlock/commit/e785b99338)), string for defining response type / JSON string with properties to set on the returned response instance, original response type is used if not specified: - `ok`, supported values: `false`, `true` - - `type`, supported values: `"basic"`, `"cors"`, `"opaque"` + - `type`, supported values: `"basic"`, `"cors"`, `"default"`, `"error"`, `"opaque"` + - `statusText`, supported values: `""`, `"Not Found"`. defaults +to `"OK"` when not overridden. [1.58.1rc5](https://github.com/gorhill/uBlock/commit/9ce30563613495f5b609211c017aed580847a9cf) When used without parameters, the parameters passed to `no-fetch-if` will be logged to the console, as `uBO: fetch([...list of arguments...])`. Examples: - `example.com##+js(no-fetch-if, method:HEAD)` - `example.com##+js(no-fetch-if, adsbygoogle.js)` + - `example.com##+js(no-fetch-if, !negatedValue)` - `example.com##+js(no-fetch-if, adsbygoogle.js method:HEAD)` - `example.com##+js(no-fetch-if, /adsbygoogle.js$/ method:/HEAD|POST/)` - - `example.com##+js(no-fetch-if, !negatedValue)` + - `example.com##+js(no-fetch-if, adsbygoogle.js, length:11000)` + - `example.com##+js(no-fetch-if, adsbygoogle.js, war:googlesyndication_adsbygoogle.js)` + - `example.com##+js(no-fetch-if, doubleclick, , '{"type": "opaque"}')` See also: - [AdGuard `prevent-fetch`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-fetch) @@ -857,8 +869,15 @@ Defuses [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHtt Parameters: - optional, space-separated list of conditions which must be ALL fulfilled in order for the defusing to take place: - - string/_regular expression_ matching in URL passed to XMLHttpRequest `open()` call + - string/_regular expression_, prefixed by `!` for negation, matching in URL passed to XMLHttpRequest `open()` call - colon-separated `name:value` pairs of [XMLHttpRequest method `open()`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open#parameters) parameter names (only `method` and `url` currently supported) and string/_regular expression_ matching in value of passed argument. + - optional, arguments to define the response body, possible values: + - `true` to randomize the response, random 10-character string [1.51.1b15](https://github.com/gorhill/uBlock/commit/418087d) + - `emptyObj` to return the response value as empty object [1.54.1rc2](https://github.com/gorhill/uBlock/commit/e1ae17e) + - `emptyArr` to return the response value as empty array [1.54.1rc2](https://github.com/gorhill/uBlock/commit/e1ae17e) + - `emptyStr` to return the response value as empty string [1.54.1rc2](https://github.com/gorhill/uBlock/commit/e1ae17e) + - `length:min[-max]` to fulfill the response with randomized text with length specified, limited to 500000 characters [1.54.1b1](https://github.com/gorhill/uBlock/commit/6aeab2a) + - `war:[name of resource]` to fulfill the response with the content of a [web_accessible_resources](https://github.com/gorhill/uBlock/tree/master/src/web_accessible_resources) resource [1.51.1b16](https://github.com/gorhill/uBlock/commit/bf591d9) When used without parameters, the parameters passed to `no-xhr-if` will be logged to the console, as `uBO: xhr.open(...list of arguments...)`. @@ -867,6 +886,8 @@ Examples: - `example.com##+js(no-xhr-if, adsbygoogle.js)` - `example.com##+js(no-xhr-if, adsbygoogle.js method:HEAD)` - `example.com##+js(no-xhr-if, /adsbygoogle.js$/ method:/HEAD|POST/)` + - `example.com##+js(no-xhr-if, adsbygoogle.js, length:11000)` + - `example.com##+js(no-xhr-if, doubleclick.net/instream/ad_status.js, war:doubleclick_instream_ad_status.js)` Also see: - [AdGuard `prevent-xhr`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-xhr)