@scriptlet prevent-dialog
@description
Programmatically close `dialog` elements.
@param [selector]
Optional. The dialog element must matches `dialog{selector}` for the
prevention to take place.
@usage:
example.com##+js(prevent-dialog)
Related discussion/issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2917
- https://github.com/uBlockOrigin/uAssets/discussions/30124
The "list of selectors" parameter is now a "list of steps". A step
can be:
- A selector, which tells the scriptlet to click a matching element. If
no matching element is found, the scriptlet will wait for a matching
element to become available.
- An integer, which tells the scriptlet to wait n ms before processing
the next step
- A directive, which is a string starting with `!` (not implemented yet)
If the last item in the list is an integer, this tells the scriplet to
override the built-in timeout value of 10s, such that the life time of
the scriptlet can now be extended beyond 10s.
Example:
..##+js(trusted-click-element, '1000, a, 500, b, c, 15000')
The scriptlet filter above will perform the following steps, in order:
- Prepare the scriptlet to timeout at 15s from now
- Wait 1000 ms
- Wait for element `a` to become available then click on it
- Wait 500 ms
- Wait for element `b` to become available then click on it
- Wait for element `c` to become available then click on it
- Abort if all the steps cannot be completed before 15s
The changes keep compatiblity with older syntax or with AdGuard
syntax.
As discussed with filter list maintainers.
* @scriptlet trusted-create-element
*
* @description
* Element(s) from a parsed HTML string are added as child element(s) to a
* specific parent element in the DOM.
*
* @param parent
* A CSS selector identifying the element to which created element(s) will be
* added.
*
* @param html
* An HTML string to be parsed using DOMParser, and which resulting elements
* are to be added as child element(s).
*
* @param duration
* Optional. If specified, the time in ms after which the added elements will
* be removed. No removal will occur if not specified.
Scriptlets added:
- json-edit
- trusted-json-edit
- json-edit-xhr-response
- trusted-json-edit-xhr-response
- json-edit-fetch-response
- trusted-json-edit-fetch-response
- jsonl-edit-xhr-response
- trusted-jsonl-edit-xhr-response
- jsonl-edit-fetch-response
- trusted-jsonl-edit-fetch-response
These scriptlets are functionally similar to their `json-prune` counterpart,
except that they all use the new uBO-flavored JSONPath syntax, and the
`trusted-` versions allow to modify values instead of just removing them.
The `replace=` filter option has been extended to support applying
uBO-flavored JSONPath syntax to the response body. If the `replace=`
value starts with `json:` or `jsonl:`, the remaining of the value will
be interpreted as a JSONPath directive, which can be used to either
remove or modify property in a JSON document.
@description
Conditionally prevent assignment to `innerHTML` property.
@param [selector]
Optional. The element must matches `selector` for the prevention to take
place.
@param [pattern]
Optional. A pattern to match against the assigned value. The pattern can be
a plain string, or a regex. Prepend with `!` to reverse the match condition.
As discussed with filter list volunteers.
Add support for range for the `delay` paramater:
---
@param [delay]
A value to match against the delay. Can be a single value for exact match,
or a range:
- `min-max`: matches if delay >= min and delay <= max
- `min-`: matches if delay >= min
- `-max`: matches if delay <= max
No delay means to match any delay value.
Prepend with `!` to reverse the match condition.
---
As discussed with filter list maintainers.