mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
add trusted-prevent-fetch, trusted-create-html, update trusted-set-cookie
parent
c47863898d
commit
6db4d4417d
1 changed files with 37 additions and 1 deletions
|
|
@ -37,10 +37,12 @@
|
|||
- [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)_
|
||||
- [trusted-create-HTML](#trusted-create-htmljs-) [Trusted]
|
||||
- [prevent-innerHTML](#prevent-innerHTMLjs-)
|
||||
- [prevent-xhr](#prevent-xhrjs-) _(no-xhr-if)_
|
||||
- [trusted-prevent-xhr](#trusted-prevent-xhrjs-) [Trusted]
|
||||
- [prevent-fetch](#prevent-fetchjs-) _(no-fetch-if)_
|
||||
- [trusted-prevent-fetch](#trusted-prevent-fetchjs-) [Trusted]
|
||||
- [trusted-replace-xhr-response](#trusted-replace-xhr-responsejs-) [Trusted]
|
||||
- [trusted-replace-fetch-response](#trusted-replace-fetch-responsejs-) _(trusted-rpfr)_ [Trusted]
|
||||
- [trusted-replace-argument](#trusted-replace-argumentjs-) [Trusted]
|
||||
|
|
@ -778,6 +780,16 @@ See also:
|
|||
|
||||
***
|
||||
|
||||
### trusted-prevent-fetch.js [↪](https://github.com/gorhill/uBlock/blob/f106a810528825ae3e3683bf7aab2f247d91d311/src/js/resources/prevent-fetch.js#L197)
|
||||
|
||||
#### _Trusted scriptlet_
|
||||
|
||||
New in [1.63.3b8](https://github.com/gorhill/uBlock/commit/4ce26b63ff5d0560ec3f529e275a8430a0db7327)
|
||||
|
||||
Essentially the same as [`prevent-fetch`](#prevent-fetchjs) except that if the `directive` argument is not a known token, it will be used as is as the response text of the fetch request, whereas `prevent-fetch` returns an empty string when the directive is unknown.
|
||||
|
||||
***
|
||||
|
||||
### trusted-replace-xhr-response.js [↪](https://github.com/gorhill/uBlock/blob/66e3a1ad47162a89709e99072e5eaecdd83cb633/assets/resources/scriptlets.js#L4362)
|
||||
|
||||
#### _Trusted scriptlet_
|
||||
|
|
@ -1014,6 +1026,27 @@ example.com##+js(prevent-innerHTML, body, adblock)
|
|||
|
||||
***
|
||||
|
||||
### trusted-create-HTML.js [↪](https://github.com/gorhill/uBlock/blob/f106a810528825ae3e3683bf7aab2f247d91d311/src/js/resources/create-html.js#L49)
|
||||
|
||||
#### _Trusted scriptlet_
|
||||
|
||||
New in [1.63.3b15](https://github.com/gorhill/uBlock/commit/20dd6065049d0a80b23db83011ae0c10ce34cbd2)
|
||||
|
||||
Element(s) from a parsed HTML string are added as child element(s) to a specific parent element in the DOM.
|
||||
|
||||
Parameters:
|
||||
|
||||
- required, `parent`: A CSS selector identifying the element to which created element(s) will be added.
|
||||
- required, `html`: An HTML string to be parsed using DOMParser, and which resulting elements are to be added as child element(s).
|
||||
- optional, `duration`: If specified, the time in ms after which the added elements will be removed. No removal will occur if not specified.
|
||||
|
||||
Example:
|
||||
|
||||
```adblock
|
||||
example.org##+js(trusted-create-html, html, <iframe src=""></iframe>)
|
||||
```
|
||||
***
|
||||
|
||||
### prevent-xhr.js [↪](https://github.com/gorhill/uBlock/blob/745fbd1c02b7179052ba97f51c54f7cb000636f0/assets/resources/scriptlets.js#L1171)
|
||||
### no-xhr-if.js
|
||||
|
||||
|
|
@ -1710,7 +1743,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_.
|
||||
- `domain, [value]`: the scriptlet will set the domain of the cookie to _value_. Regex is supported ([1.64.1b5](https://github.com/gorhill/uBlock/commit/3a2bb625190488b18c1486e51a1dc8fa465c14b4)), if used it will be matched against `document.location.hostname`.
|
||||
- `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-`.
|
||||
|
|
@ -1722,6 +1755,7 @@ Examples:
|
|||
- `example.com##+js(trusted-set-cookie, cmpconsent, accept, 259200)`
|
||||
- `example.com##+js(trusted-set-cookie, cmpconsent, accept, 1year)`
|
||||
- `example.com##+js(trusted-set-cookie, cmpconsent, decline, , none)`
|
||||
- `www.google.*##+js(trusted-set-cookie, SOCS, CAESHAgBEhJnd3NfMjAyNTA2MDQtMF9SQzEaAnJvIAEaBgiAgo7CBg, 1year, , domain, /\bgoogle\..+$/, dontOverwrite, 1)`
|
||||
|
||||
The second and third filters will set a cookie with `new Date().getTime()` value.
|
||||
|
||||
|
|
@ -1729,6 +1763,8 @@ The forth and fifth filters will set a cookie which will expire in 3 days or 1 y
|
|||
|
||||
The sixth filter sets a cookie with no path.
|
||||
|
||||
The seventh filter sets a cookie where the domain value is the result of the regex matched against `document.location.hostname`.
|
||||
|
||||
Also see:
|
||||
- [set-cookie](#set-cookiejs-)
|
||||
- [AdGuard `trusted-set-cookie`](https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-set-cookie)
|
||||
|
|
|
|||
Loading…
Reference in a new issue