From 127b431c6b6f041a0a0dd18c3155eeca9e76acf4 Mon Sep 17 00:00:00 2001 From: D4niloMR <70459964+D4niloMR@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:15:45 -0300 Subject: [PATCH] Updated Resources Library (markdown) --- Resources-Library.md | 77 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/Resources-Library.md b/Resources-Library.md index ae58196..3d87fc0 100644 --- a/Resources-Library.md +++ b/Resources-Library.md @@ -336,7 +336,8 @@ Logs to the console event listeners created on page. The logging or debugging of `addEventListener()` calls can now be done with the [`addEventListenerDefuser`](#addeventlistener-defuserjs-) scriptlet, which now supports named arguments. -Also see: [AdGuard `log-addEventListener`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-addEventListener) +Also see: +- [AdGuard `log-addEventListener`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#log-addEventListener) *** @@ -457,9 +458,43 @@ New in [1.51.1b14](https://github.com/gorhill/uBlock/commit/cfac880cf51d8c652ce3 New in [1.52.3rc0](https://github.com/gorhill/uBlock/commit/1c9da227d714250c0b6319e2f635998f9869a70d) -Also see: [AdGuard `trusted-prune-inbound-object`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-prune-inbound-object) +To perform object pruning for any given call which has an object +as argument (hence "inbound"). + +Parameters: + +- The name of the property to trap. Must be a function, and must + exist when the scriptlet tries to install the trap. +- The position of the object to prune in the argument list when + the trapped function is called. The position is 1-based and + must be an integer greater than 0. +- The properties to prune (as with [`json-prune`](#json-prunejs-)) +- The properties which must all be present for pruning to occur + (as with [`json-prune`](#json-prunejs-)) + +Varargs: + - `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: + +1. Remove `title` and `name` properties before passing the object to +`JSON.stringify` call: + + ```adblock + example.org##+js(trusted-prune-inbound-object, JSON.stringify, 1, title name) + ``` + +2. Remove `status` property before passing the object to `Object.keys` +call but do not modify caller's instance of the object: + + ```adblock + example.org##+js(trusted-prune-inbound-object, Object.keys, 1, status, , dontOverwrite, 1) + ``` + +Also see: +- [AdGuard `trusted-prune-inbound-object`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-prune-inbound-object) -[Documentation to be completed] *** @@ -469,7 +504,23 @@ Also see: [AdGuard `trusted-prune-inbound-object`](https://github.com/AdguardTea New in [1.52.3rc3](https://github.com/gorhill/uBlock/commit/86f0d6dd978b79a34ffa257825539fb4446759a4) -[Documentation to be completed] +Essentially a complement of [`trusted-prune-inbound-object`](trusted-prune-inbound-objectjs-) added in [1.52.3rc0](https://github.com/gorhill/uBlock/commit/1c9da227d714250c0b6319e2f635998f9869a70d) + +To perform object pruning on any object returned synchronously by +any given call. + +Parameters: + +- The name of the property to trap. Must be a function, and must + exist when the scriptlet tries to install the trap. +- The properties to prune (as with [`json-prune`](#json-prunejs-)) +- The properties which must all be present for pruning to occur + (as with [`json-prune`](#json-prunejs-)) + +The scriptlets `json-prune` and `evaldata-prune` essentially +perform the same function, and will eventually be rewritten to +internally delegate to generic `trusted-prune-outbound-object`. + *** @@ -565,7 +616,8 @@ tumblr.com##+js(json-prune-fetch-response, response.timeline.elements.[-].advert nbc.com##+js(json-prune-fetch-response, avails, , propsToMatch, amazonaws.com) ``` -Also see: [AdGuard `json-prune-fetch-response`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-fetch-response) +Also see: +- [AdGuard `json-prune-fetch-response`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-fetch-response) *** @@ -584,7 +636,7 @@ www.facebook.com##+js(json-prune-xhr-response, data.viewer.instream_video_ads da ``` Also see: -[AdGuard `json-prune-xhr-response`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-xhr-response) +- [AdGuard `json-prune-xhr-response`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune-xhr-response) *** @@ -635,8 +687,7 @@ Also see: *** -### noeval.js [↪] -(https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/noeval.js) +### noeval.js [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/noeval.js) Prevent web pages from using _`eval()`_, and report attempts to the logger. This should not be used as a generic filter due to the fact that it breaks many websites, including those using Cloudflare's DDoS protection. Examples: @@ -741,7 +792,8 @@ For usage, see: [trusted-replace-fetch-response](#trusted-replace-fetch-response Example: - `in-jpn.com##+js(trusted-replace-xhr-response, /.*/, , pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?)` -Also see: [AdGuard `trusted-replace-xhr-response`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-replace-xhr-response) +Also see: +- [AdGuard `trusted-replace-xhr-response`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-replace-xhr-response) *** @@ -1188,8 +1240,8 @@ if not provided or empty, the scriptlet will only log the outbound text without can be omitted if the goal is to delete the text which matches the pattern. Tokens: - - `condition, pattern`: is a vararg which tells the scriptlet to act only if `pattern` is found in the argument to overwrite. - - `encoding, base64`: Decode and encode outbound base64 text before and after replacement. [1.58.1b3](https://github.com/gorhill/uBlock/commit/fa6740a059) + - `condition, pattern`: is a vararg which tells the scriptlet to act only if `pattern` is found in the outbound text. + - `encoding, base64`: Decode and encode outbound base64-encoded text before and after replacement. [1.58.1b3](https://github.com/gorhill/uBlock/commit/fa6740a059) Examples: - `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify)` (logging only) @@ -1452,7 +1504,8 @@ example.org##+js(trusted-suppress-native-method, sessionStorage.setItem, ' |"ite 5. Abort `Array.prototype.concat([1, 'str', true, null])` calls by matching array argument contents. 6. Use stack argument to match by the call, while also matching the second argument. -Also see: [AdGuard `trusted-suppress-native-method`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-suppress-native-method) +Also see: +- [AdGuard `trusted-suppress-native-method`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-suppress-native-method) ***