From a5c0afa910363fd15885e50b5584b0d3fd4444e0 Mon Sep 17 00:00:00 2001 From: D4niloMR <70459964+D4niloMR@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:20:14 -0300 Subject: [PATCH] added new special properties of spoof-css --- Resources-Library.md | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Resources-Library.md b/Resources-Library.md index ec702cc..5c18d49 100644 --- a/Resources-Library.md +++ b/Resources-Library.md @@ -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: [1.61.1b4](https://github.com/gorhill/uBlock/commit/5f5e3d730fabe0e98e2f9931ad3c36113b7b9893) + - `_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).