mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
update href-sanitizer and set-cookie
parent
3e8a72ba77
commit
10697e8ec5
1 changed files with 11 additions and 7 deletions
|
|
@ -1294,20 +1294,22 @@ Also see:
|
|||
|
||||
New in [1.47.5b4](https://github.com/gorhill/uBlock/commit/e123256eaf64be19f81eba123970db07b45eb0ae)
|
||||
|
||||
Set the `href` attribute to a value found in the DOM at, or below the targeted `a` element, and optionally with transformation steps.
|
||||
|
||||
Parameters:
|
||||
- required, a CSS selector which matches the elements for which the scriptlet should replace the `href` attribute with the text content of the element, if ALL the following conditions are met:
|
||||
- required, A plain CSS selector for elements which `href` property must be sanitized, if ALL the following conditions are met:
|
||||
- The element is a link (`<a>`) element
|
||||
- The link element has an existing `href` attribute
|
||||
- The text content of the element is a valid `https`-based URL
|
||||
- optional, the attribute from which to extract the text to be used for the `href` attribute of the link, otherwise the text content of the element will be used.
|
||||
- If the second parameter starts with `?`, the scriptlet will look up the value of the search parameter which name is what comes after the `?`. <sup>(New in [1.49.3rc15](https://github.com/gorhill/uBlock/commit/56e1d92dbd65e6168620053b1fec4c21c03d664e))</sup>. Supports ability to recursively unwrap search parameters. <sup>[1.58.1rc11](https://github.com/gorhill/uBlock/commit/84be9cde6d)</sup>
|
||||
- optional, one or more tokens to lookup the source of the `href` property, and optionally the transformation steps to perform, otherwise the text content of the element will be used.
|
||||
- `[name]`: Use the value of the attribute `name` as the URL
|
||||
- `?name`: Use the value of the `href` query parameter `name` <sup>[1.49.3rc15](https://github.com/gorhill/uBlock/commit/56e1d92dbd65e6168620053b1fec4c21c03d664e)</sup>. Supports unwrapping query parameters recursively <sup>[1.58.1rc11](https://github.com/gorhill/uBlock/commit/84be9cde6d)</sup>
|
||||
- Transformation steps: see [`urlskip`](../Static-filter-syntax#urlskip) documentation <sup>[1.61.3b10](https://github.com/gorhill/uBlock/commit/9bf8d53ebe7cab20ac8491741c5b99cf9d35d643)</sup>
|
||||
|
||||
Examples:
|
||||
- `vk.com##+js(href-sanitizer, a[href^="/go?to="][title], [title])`
|
||||
- `vk.com##+js(href-sanitizer, a[href^="/away.php?to="][title], ?to)`
|
||||
- `<a href="https://app.adjust.com/2uo1qc?redirect=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dorg.mozilla.firefox&campaign=www.mozilla.org&adgroup=mobile-android-page">Text</a>`:
|
||||
`mozilla.org##+js(href-sanitizer, a[href^="https://app.adjust.com/"][href*="?redirect="], ?redirect)`
|
||||
- `example.com##+js(href-sanitizer, a.clickTracker, ?r?u)`
|
||||
- `example.org##+js(href-sanitizer, a[href*="/redirect"], ?url ?url -base64)`
|
||||
|
||||
Solves [Anti-redirect scriptlet for vk.com (href-sanitizer)](https://github.com/uBlockOrigin/uBlock-issues/issues/2531).
|
||||
|
||||
|
|
@ -1600,7 +1602,8 @@ Parameters:
|
|||
- `ok`,
|
||||
- `on`<sup>1</sup> / `off`<sup>1</sup>,
|
||||
- `true` / `t`<sup>3</sup> / `false` / `f`<sup>3</sup>,
|
||||
- `yes` / `y` / `no` / `n`
|
||||
- `yes` / `y` / `no` / `n`,
|
||||
- `all`<sup>10</sup> / `none`<sup>10</sup> / `functional`<sup>10</sup>
|
||||
- optional, cookie path, defaults to /; possible values:
|
||||
- `/`: root path
|
||||
- `none`: to set no path at all
|
||||
|
|
@ -1614,6 +1617,7 @@ Parameters:
|
|||
<sup>7. [1.58.1rc0](https://github.com/gorhill/uBlock/commit/37d31a82d8)</sup>
|
||||
<sup>8. [1.59.1b5](https://github.com/gorhill/uBlock/commit/3e2171f550)</sup>
|
||||
<sup>9. [1.60.1b12](https://github.com/gorhill/uBlock/commit/4d982d9972be4eb0a23e289c6f3ec3ae8cca36f2)</sup>
|
||||
<sup>10. [1.61.3b10](https://github.com/gorhill/uBlock/commit/791a2b08e1a15c169c0a86130de769822628c81d)</sup>
|
||||
|
||||
The scriptlet encodes cookie names and values, e.g value "{ test: 'value'}" becomes `%7B%20test%3A%20'value'%7D`.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue