mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
added new special properties of spoof-css
parent
cfe1b1cde0
commit
a5c0afa910
1 changed files with 19 additions and 7 deletions
|
|
@ -1795,19 +1795,31 @@ Parameters:
|
|||
- required, the value to return regardless of the currently computed value
|
||||
|
||||
Examples:
|
||||
- `example.com##+js(spoof-css, .ad, clip-path, none)`
|
||||
- ```adblock
|
||||
example.com##+js(spoof-css, .ad, clip-path, none)
|
||||
example.com##+js(spoof-css, .ad, _debug, 1)
|
||||
```
|
||||
|
||||
There can be any number of selectors, all separated by escaped commas:
|
||||
There can be any number of selectors, grouped inside single quotes:
|
||||
|
||||
- `example.com##+js(spoof-css, a[href="x.com"]\, .ads\, .bottom, clip-path, none)`
|
||||
- ```adblock
|
||||
example.com##+js(spoof-css, 'a[href="x.com"], .ads, .bottom', clip-path, none)
|
||||
```
|
||||
|
||||
There can be any number of property-name/property-value pairs, all separated by commas:
|
||||
|
||||
- `example.com##+js(spoof-css, .ad, clip-path, none, display, block)`
|
||||
- ```adblock
|
||||
example.com##+js(spoof-css, .ad, clip-path, none, display, block)
|
||||
```
|
||||
|
||||
Tokens:
|
||||
- `debug, 1`: Force the browser to break when `getComputedStyle()` or `getBoundingClientrect()` is called, useful to help pinpoint usage of those calls in the page's source code:
|
||||
`example.com##+js(spoof-css, .ad, debug, 1)`
|
||||
Special properties: <sup>[1.61.1b4](https://github.com/gorhill/uBlock/commit/5f5e3d730fabe0e98e2f9931ad3c36113b7b9893)</sup>
|
||||
- `_debug, 1`: Force the browser to break when `getComputedStyle()` or `getBoundingClientRect()` is called, useful to help pinpoint usage of those calls in the page's source code.
|
||||
- `_rectx, value`: Spoof the [`DOMRect.x`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/x) returned by [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/DOMRect).
|
||||
- `_recty, value`: Spoof the [`DOMRect.y`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/y) returned by [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/DOMRect).
|
||||
- `_rectw, value`: Spoof the [`DOMRect.width`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/width) returned by [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/DOMRect).
|
||||
- `_recth, value`: Spoof the [`DOMRect.height`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/height) returned by [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect/DOMRect).
|
||||
|
||||
If both `_rectw` and `width` are present in the list of properties to spoof, `_rectw` will have precedence over `width` in the spoofing of `getBoundingClientRect()` output. Same for `_recth`.
|
||||
|
||||
Solves [uBlockOrigin/uBlock-issues#2618](https://github.com/uBlockOrigin/uBlock-issues/issues/2618).
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue