diff --git a/Resources-Library.md b/Resources-Library.md index 732c46f..139679a 100644 --- a/Resources-Library.md +++ b/Resources-Library.md @@ -114,10 +114,8 @@ ## Available URL-specific sanitized redirect resources (surrogates) -- [addthis_widget.js](#addthis_widgetjs-) - [amazon_ads.js](#amazon_adsjs-) - [amazon_apstag.js](#amazon_apstagjs-) -- [monkeybroker.js](#monkeybrokerjs-) - [doubleclick_instream_ad_status](#doubleclick_instream_ad_statusjs-) - [google-analytics_ga.js](#google-analytics_gajs-) - [google-analytics_analytics.js](#google-analytics_analyticsjs-) @@ -1087,6 +1085,10 @@ if not provided or empty, the scriptlet will only log the outbound text without - optional, the replacement string for the matched part, 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) + Examples: - `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify)` (logging only) - `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify, '/"csrf_token":"[^"]+",/')` @@ -1096,6 +1098,7 @@ matches and removes: `"csrf_token":"ed5ce21c7d7c95c8662c7844c0f4a4dc",` from the matches `ed5ce21c7d7c95c8662c7844c0f4a4dc` or any similiar value in `"csrf_token":"..."` and removes it resulting in empty value: `"csrf_token":""` - `www.reddit.com##+js(trusted-replace-outbound-text, JSON.stringify, '/(?<="adblock":{"enabled":)true/', false)` matches `true` in `"adblock":{"enabled":true` and replaces it with `false` resulting in a new spoofed value: `"adblock":{"enabled":false` +- `example.com##+js(trusted-replace-outbound-text, eval, ads:true, ads:false, encoding, base64)` For instance, `eval('"YWRzOnRydWU="')` which decoded value is 'ads:true', will return 'YWRzOmZhbHNl' which is 'ads:false' after decoding. When the replacement starts with `json:`, it will be first decoded using JSON.parse() (since [1.59.1b8](https://github.com/gorhill/uBlock/commit/0dcb985601)), example: @@ -1115,8 +1118,6 @@ Solves related issues / discussions: Also see: - [AdGuard `trusted-replace-outbound-text`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-replace-outbound-text) -[Documentation to be completed] - *** ### href-sanitizer.js [↪](https://github.com/gorhill/uBlock/blob/d7b7dea7faaf17486d5c54454852c4a117f50fd1/assets/resources/scriptlets.js#L1845) @@ -1131,13 +1132,14 @@ Parameters: - The link element has an existing `href` attribute - The text content of the element is a valid `https`-based URL - optional, the attribute from which to extract the text to be used for the `href` attribute of the link, otherwise the text content of the element will be used. - - If the second parameter starts with `?`, the scriptlet will look up the value of the search parameter which name is what comes after the `?`. (New in [1.49.3rc15](https://github.com/gorhill/uBlock/commit/56e1d92dbd65e6168620053b1fec4c21c03d664e)) + - If the second parameter starts with `?`, the scriptlet will look up the value of the search parameter which name is what comes after the `?`. (New in [1.49.3rc15](https://github.com/gorhill/uBlock/commit/56e1d92dbd65e6168620053b1fec4c21c03d664e)). Supports ability to recursively unwrap search parameters. [1.58.1rc11](https://github.com/gorhill/uBlock/commit/84be9cde6d) Examples: - `vk.com##+js(href-sanitizer, a[href^="/go?to="][title], [title])` - `vk.com##+js(href-sanitizer, a[href^="/away.php?to="][title], ?to)` - `Text`: `mozilla.org##+js(href-sanitizer, a[href^="https://app.adjust.com/"][href*="?redirect="], ?redirect)` + - `example.com##+js(href-sanitizer, a.clickTracker, ?r?u)` Solves [Anti-redirect scriptlet for vk.com (href-sanitizer)](https://github.com/uBlockOrigin/uBlock-issues/issues/2531). @@ -1394,6 +1396,7 @@ The scriptlet encodes cookie names and values, e.g value "{ test: 'value'}" beco Tokens: - `reload, 1`: the scriplet will force a reload of the webpage if the cookie being set was not already set. + - `dontOverwrite, 1`: the scriptlet will not modify the cookie if it already exists. `; Secure` will be automatically used when cookie names starts with `__Secure-` or `__Host-` (since [1.58.1b8](https://github.com/gorhill/uBlock/commit/b4d8750f445cfa06bebd184a6f3cdb4d73148e72)). @@ -1436,6 +1439,7 @@ Parameters: Variadic parameters (must appears after required and optional parameters): - `reload, 1`: the scriplet will force a reload of the webpage if the cookie being set was not already set. - `domain, [value]`: the scriptlet will set the domain of the cookie to _value_. + - `dontOverwrite, 1`: the scriptlet will not modify the cookie if it already exists. `; Secure` will be automatically used when cookie names starts with `__Secure-` or `__Host-`. @@ -1811,7 +1815,12 @@ They purpose is to mislead page to think that real files have been served. - `noop.css` [↪](https://github.com/gorhill/uBlock/blob/4564e3a9b8d3cb2afb70ebd2161271f6b9b969bc/src/web_accessible_resources/noop.css) - `noop.html` [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/noop.html) - `noop.js` [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/noop.js) + - `noop.json` [↪](https://github.com/gorhill/uBlock/blob/ff57f01026f1b98ca9d9a8bb36386ae9dfd3eae3/src/web_accessible_resources/noop.json) - `noop.txt` [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/noop.txt) + - `noop-vast2.xml` [↪](https://github.com/gorhill/uBlock/blob/ff57f01026f1b98ca9d9a8bb36386ae9dfd3eae3/src/web_accessible_resources/noop-vast2.xml) + - `noop-vast3.xml` [↪](https://github.com/gorhill/uBlock/blob/ff57f01026f1b98ca9d9a8bb36386ae9dfd3eae3/src/web_accessible_resources/noop-vast3.xml) + - `noop-vast4.xml` [↪](https://github.com/gorhill/uBlock/blob/ff57f01026f1b98ca9d9a8bb36386ae9dfd3eae3/src/web_accessible_resources/noop-vast4.xml) + - `noop-vmap1.xml` [↪](https://github.com/gorhill/uBlock/blob/ff57f01026f1b98ca9d9a8bb36386ae9dfd3eae3/src/web_accessible_resources/noop-vmap1.xml) - Media files - `noop-0.1s.mp3` [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/noop-0.1s.mp3) - `noop-0.5s.mp3` [↪](https://github.com/gorhill/uBlock/blob/c521479ef9d9676e08fcd6751fde7330dce189e7/src/web_accessible_resources/noop-0.5s.mp3) @@ -1834,18 +1843,12 @@ Example rule: -### addthis_widget.js / -### ~addthis.com/addthis_widget.js~ [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/addthis_widget.js) - ### amazon_ads.js / ### ~amazon-adsystem.com/aax2/amzn_ads.js~ [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/amazon_ads.js) ### amazon_apstag.js [↪](https://github.com/gorhill/uBlock/blob/f842ab6d3c1cf0394f95d27092bf59627262da40/src/web_accessible_resources/amazon_apstag.js) New in [1.27.0](https://github.com/gorhill/uBlock/commit/f842ab6d3c1cf0394f95d27092bf59627262da40). -### monkeybroker.js / -### ~d3pkae9owd2lcf.cloudfront.net/mb105.js~ [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/monkeybroker.js) - ### doubleclick_instream_ad_status.js / ### ~doubleclick.net/instream/ad_status.js~ [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/doubleclick_instream_ad_status.js) @@ -1905,6 +1908,11 @@ Deprecated, sets static properties (`pSUPERFLY.activity`, `pSUPERFLY.virtualPage ### ~ligatus.com/*/angular-tag.js~ [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/ligatus_angular-tag.js) Deprecated, sets static properties (`adProtect`, `uabpdl`, `uabDetect`) +### addthis_widget.js / +### ~addthis.com/addthis_widget.js~ [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/addthis_widget.js) + +### monkeybroker.js / +### ~d3pkae9owd2lcf.cloudfront.net/mb105.js~ [↪](https://github.com/gorhill/uBlock/blob/a94df7f3b27080ae2dcb3b914ace39c0c294d2f6/src/web_accessible_resources/monkeybroker.js) ***