Skip to content

Commit

Permalink
Merge branch 'master' into fix/AG-34532
Browse files Browse the repository at this point in the history
  • Loading branch information
jellizaveta committed Jul 25, 2024
2 parents 7cabd76 + 3b500cf commit 46f05ef
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adguard/scriptlets",
"version": "1.11.11",
"version": "1.11.13",
"description": "AdGuard's JavaScript library of Scriptlets and Redirect resources",
"scripts": {
"build": "babel-node -x .js,.ts scripts/build.js",
Expand Down
14 changes: 11 additions & 3 deletions src/scriptlets/trusted-create-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ import type { ParsedAttributePair } from '../helpers/attribute-utils';
*
* ### Syntax
*
* <!-- markdownlint-disable line-length -->
*
* ```text
* example.com#%#//scriptlet('trusted-create-element', parentSelector, tagName[, attributePairs[, textContent[, cleanupDelayMs]]]) <!-- markdownlint-disable-line line-length -->
* example.com#%#//scriptlet('trusted-create-element', parentSelector, tagName[, attributePairs[, textContent[, cleanupDelayMs]]])
* ```
*
* <!-- markdownlint-enable line-length -->
*
* - `parentSelector` — required, CSS selector of the parent element to append the created element to.
* - `tagName` — required, tag name of the created element.
* - `attributePairs` — optional, space-separated list of attribute name and value pairs separated by `=`.
Expand All @@ -48,10 +52,14 @@ import type { ParsedAttributePair } from '../helpers/attribute-utils';
*
* 1. Create a button element with multiple attributes, including attribute without value, and text content
*
* <!-- markdownlint-disable line-length -->
*
* ```adblock
* example.com#%#//scriptlet('trusted-create-element', 'body', 'button', 'disabled aria-hidden="true" style="width: 0px"', 'Press here') <!-- markdownlint-disable-line line-length -->
* example.com#%#//scriptlet('trusted-create-element', 'body', 'button', 'disabled aria-hidden="true" style="width: 0px"', 'Press here')
* ```
*
* <!-- markdownlint-enable line-length -->
*
* 1. Create a button element with an attribute whose value contains quotes
*
* ```adblock
Expand All @@ -61,7 +69,7 @@ import type { ParsedAttributePair } from '../helpers/attribute-utils';
* 1. Create a paragraph element with text content and remove it after 5 seconds
*
* ```adblock
* example.com#%#//scriptlet('trusted-create-element', '.container > article', 'p', '', 'Hello world!', 5000)
* example.com#%#//scriptlet('trusted-create-element', '.container > article', 'p', '', 'Hello world!', '5000')
* ```
*
* @added v1.10.1.
Expand Down
4 changes: 2 additions & 2 deletions src/scriptlets/trusted-replace-node-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import {
*
* ### Syntax
*
* ```adblock
* ```text
* example.org#%#//scriptlet('trusted-replace-node-text', nodeName, textMatch, pattern, replacement)
* ```
*
* - `nodeName` — required, string or RegExp, specifies DOM node name from which the text will be removed.
* Must target lowercased node names, e.g `div` instead of `DIV`.
* - `textMatch` — required, string or RegExp to match against node's text content.
* If matched, the whole text will be removed. Case sensitive.
* If matched, the `pattern` will be replaced by the `replacement`. Case sensitive.
* - `pattern` — required, string or regexp for matching contents of `node.textContent` that should be replaced.
* - `replacement` — required, string to replace text content matched by `pattern`.
* - `...extraArgs` — optional, string, if includes 'verbose' will log original and modified text content.
Expand Down
2 changes: 1 addition & 1 deletion src/scriptlets/trusted-replace-outbound-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ import {
* 1. Call with `decodeMethod` and `logContent` arguments will log original and decoded text content of the specified function:
*
* ```adblock
* example.org#%#//scriptlet('trusted-replace-outbound-text', 'Array.prototype.join', '', '', 'base64' , '', 'true')
* example.org#%#//scriptlet('trusted-replace-outbound-text', 'Array.prototype.join', '', '', 'base64', '', 'true')
* ```
*
* 1. Call with only first argument will log text content of the specified function:
Expand Down
6 changes: 5 additions & 1 deletion src/scriptlets/trusted-replace-xhr-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,14 @@ import {
*
* 1. Replace text content of XMLHttpRequests matching by URL regex and request methods
*
* <!-- markdownlint-disable line-length -->
*
* ```adblock
* example.org#%#//scriptlet('trusted-replace-xhr-response', '/#EXT-X-VMAP-AD-BREAK[\s\S]*?/', '#EXT-X-ENDLIST', '/\.m3u8/ method:/GET|HEAD/') <!-- markdownlint-disable-line line-length -->
* example.org#%#//scriptlet('trusted-replace-xhr-response', '/#EXT-X-VMAP-AD-BREAK[\s\S]*?/', '#EXT-X-ENDLIST', '/\.m3u8/ method:/GET|HEAD/')
* ```
*
* <!-- markdownlint-enable line-length -->
*
* 1. Remove all text content of all XMLHttpRequests for example.com
*
* ```adblock
Expand Down

0 comments on commit 46f05ef

Please sign in to comment.