Commit graph

25 commits

Author SHA1 Message Date
Raymond Hill
20dd606504
Add trusted-create-element scriptlet
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.
2025-04-12 10:51:50 -04:00
Raymond Hill
4ce26b63ff
Add trusted-prevent-fetch scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/915#discussioncomment-12077068
2025-04-03 11:59:00 -04:00
Raymond Hill
b18daa53aa
Add json-edit suite of scriptlets; extend replace= option
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.
2025-03-28 09:51:38 -04:00
Raymond Hill
760bd23c5e
Minor 2025-03-25 12:29:46 -04:00
Raymond Hill
68a256bdde
Improve trusted-prevent-dom-bypass scriptlet 2025-03-25 12:12:00 -04:00
Raymond Hill
95a3be9d56
Add jsonl-prune-xhr-response/jsonl-prune-fetch-response scriptlets
As discussed internally with filter list volunteers.
2025-03-22 16:01:43 -04:00
Raymond Hill
88fa550a96
Improve [json-prune|trusted-replace]-fetch-response scriptlets
Output more information to the logger in verbose mode.
2025-03-20 12:06:58 -04:00
Raymond Hill
fe744816f1
Add prevent-innerHTML scriptlet
@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.
2025-03-19 12:34:03 -04:00
Raymond Hill
9e946ce0c3
Improve trusted-override-element-method scriptlet
As discussed with filter list maintainers:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/933
2025-03-15 07:50:28 -04:00
Raymond Hill
31d82c494b
Fix typo in variable name 2025-03-06 14:15:02 -05:00
Raymond Hill
fc231998b9
Improve overlay-buster scriptlet
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3470
2025-03-06 09:50:37 -05:00
Raymond Hill
d41989e62a
Improve disable-newtab-links scriptlet
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3551
2025-02-25 13:02:44 -05:00
Raymond Hill
9c26a07b53
Improve prevent-addEventListener scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3360
2025-02-24 12:47:54 -05:00
Raymond Hill
9bb1a2baaf
Improve evaldata-prune scriptlet 2025-02-20 09:47:36 -05:00
Raymond Hill
0df7faffac
Improve noeval-if scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/2907#issuecomment-2660051167
2025-02-19 14:01:27 -05:00
Raymond Hill
f8975e3a6a
Better integrate latest eslint version 2025-01-10 10:25:15 -05:00
Raymond Hill
b617926c1c
Improve abort-on-stack-trace scriptlet
Related feedback:
https://github.com/uBlockOrigin/uAssets/issues/26704#issuecomment-2569381462
2025-01-04 20:29:19 -05:00
Raymond Hill
cb6c11ab6f
Improve trusted-suppress-native-method scriptlet
As per AdGuard's documentation `/.../` is a valid matcher, to
match a string argument against a regex pattern.
2024-12-26 08:10:13 -05:00
Raymond Hill
7494eaf621
Improve parse-properties-to-match scriptlet helper
Related issue:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/831#discussioncomment-11637436

If the property name contains unexpected characters, assume that
the `:` is not a separator.
2024-12-21 11:27:03 -05:00
Raymond Hill
9bf8d53ebe
Improve href-sanitizer scriptlet
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3487

Add support for `urlskip=` syntax by internally reusing `urlskip=`
code.
2024-12-20 10:12:33 -05:00
Raymond Hill
9b2cf0169a
Improve trusted-suppress-native-method scriptlet
Add ability to log stack trace when verbose mode is enabled.
2024-12-12 10:18:42 -05:00
Raymond Hill
7ed3470844
Improve trusted-suppress-native-method scriptlet
Add support for the `stack` parameter.
2024-12-11 08:47:10 -05:00
Raymond Hill
3417fe3d5d
Improve trusted-replace-argument scriptlet
As discussed with filter list maintainers.
2024-12-06 11:53:42 -05:00
Raymond Hill
3b7fa79a68
Improve prevent-setTimeout/prevent-setInterval scriptlet
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.
2024-11-28 11:47:28 -05:00
Raymond Hill
4d525f1a55
Move assets/resources into src/js/ 2024-11-27 16:47:11 -05:00
Renamed from assets/resources/scriptlets.js (Browse further)