1313- [ trusted-set-cookie-reload] ( #trusted-set-cookie-reload )
1414- [ trusted-set-cookie] ( #trusted-set-cookie )
1515- [ trusted-set-local-storage-item] ( #trusted-set-local-storage-item )
16+ - [ trusted-set-session-storage-item] ( #trusted-set-session-storage-item )
1617- [ trusted-suppress-native-method] ( #trusted-suppress-native-method )
1718
1819* * *
@@ -130,10 +131,14 @@ Creates an element with specified attributes and text content, and appends it to
130131
131132### Syntax
132133
134+ <!-- markdownlint-disable line-length -->
135+
133136``` text
134- example.com#%#//scriptlet('trusted-create-element', parentSelector, tagName[, attributePairs[, textContent[, cleanupDelayMs]]]) <!-- markdownlint-disable-line line-length -->
137+ example.com#%#//scriptlet('trusted-create-element', parentSelector, tagName[, attributePairs[, textContent[, cleanupDelayMs]]])
135138```
136139
140+ <!-- markdownlint-enable line-length -->
141+
137142- ` parentSelector ` — required, CSS selector of the parent element to append the created element to.
138143- ` tagName ` — required, tag name of the created element.
139144- ` attributePairs ` — optional, space-separated list of attribute name and value pairs separated by ` = ` .
@@ -160,10 +165,14 @@ example.com#%#//scriptlet('trusted-create-element', parentSelector, tagName[, at
160165
1611661. Create a button element with multiple attributes, including attribute without value, and text content
162167
168+ <!-- markdownlint-disable line-length -->
169+
163170 ```adblock
164- example.com#%#//scriptlet('trusted-create-element', 'body', 'button', 'disabled aria-hidden="true" style="width: 0px"', 'Press here') <!-- markdownlint-disable-line line-length -->
171+ example.com#%#//scriptlet('trusted-create-element', 'body', 'button', 'disabled aria-hidden="true" style="width: 0px"', 'Press here')
165172 ```
166173
174+ <!-- markdownlint-enable line-length -->
175+
1671761. Create a button element with an attribute whose value contains quotes
168177
169178 ```adblock
@@ -173,7 +182,7 @@ example.com#%#//scriptlet('trusted-create-element', parentSelector, tagName[, at
1731821. Create a paragraph element with text content and remove it after 5 seconds
174183
175184 ```adblock
176- example.com#%#//scriptlet('trusted-create-element', '.container > article', 'p', '', 'Hello world!', 5000)
185+ example.com#%#//scriptlet('trusted-create-element', '.container > article', 'p', '', 'Hello world!', ' 5000' )
177186 ```
178187
179188[Scriptlet source](../src/scriptlets/trusted-create-element.ts)
@@ -398,14 +407,14 @@ Replaces text in text content of matched DOM nodes.
398407
399408### Syntax
400409
401- ```adblock
410+ ```text
402411example.org#%#//scriptlet('trusted-replace-node-text', nodeName, textMatch, pattern, replacement)
403412```
404413
405414- ` nodeName ` — required, string or RegExp, specifies DOM node name from which the text will be removed.
406415Must target lowercased node names, e.g ` div ` instead of ` DIV ` .
407416- ` textMatch ` — required, string or RegExp to match against node's text content.
408- If matched, the whole text will be removed . Case sensitive.
417+ If matched, the ` pattern ` will be replaced by the ` replacement ` . Case sensitive.
409418- ` pattern ` — required, string or regexp for matching contents of ` node.textContent ` that should be replaced.
410419- ` replacement ` — required, string to replace text content matched by ` pattern ` .
411420- ` ...extraArgs ` — optional, string, if includes 'verbose' will log original and modified text content.
@@ -541,7 +550,7 @@ example.org#%#//scriptlet('trusted-replace-outbound-text', methodPath[, textToRe
5415501. Call with `decodeMethod` and `logContent` arguments will log original and decoded text content of the specified function:
542551
543552 ```adblock
544- example.org#%#//scriptlet('trusted-replace-outbound-text', 'Array.prototype.join', '', '', 'base64' , '', 'true')
553+ example.org#%#//scriptlet('trusted-replace-outbound-text', 'Array.prototype.join', '', '', 'base64', '', 'true')
545554 ```
546555
5475561. Call with only first argument will log text content of the specified function:
@@ -621,10 +630,14 @@ example.org#%#//scriptlet('trusted-replace-xhr-response'[, pattern, replacement[
621630
6226311. Replace text content of XMLHttpRequests matching by URL regex and request methods
623632
633+ <!-- markdownlint-disable line-length -->
634+
624635 ```adblock
625- 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 -->
636+ example.org#%#//scriptlet('trusted-replace-xhr-response', '/#EXT-X-VMAP-AD-BREAK[\s\S]*?/', '#EXT-X-ENDLIST', '/\.m3u8/ method:/GET|HEAD/')
626637 ```
627638
639+ <!-- markdownlint-enable line-length -->
640+
6286411. Remove all text content of all XMLHttpRequests for example.com
629642
630643 ```adblock
@@ -813,6 +826,8 @@ example.org#%#//scriptlet('trusted-set-cookie-reload', name, value[, offsetExpir
813826 - empty string for no value
814827 - ` $now$ ` keyword for setting current time in ms, e.g 1667915146503
815828 - ` $currentDate$ ` keyword for setting current time as string, e.g 'Tue Nov 08 2022 13:53:19 GMT+0300'
829+ - ` $currentISODate$ ` keyword for setting current date in the date time string format,
830+ e.g '2022-11-08T13:53:19.650Z'
816831- ` offsetExpiresSec ` — optional, offset from current time in seconds, after which cookie should expire;
817832 defaults to no offset. Possible values:
818833 - positive integer in seconds
@@ -890,6 +905,8 @@ example.org#%#//scriptlet('trusted-set-cookie', name, value[, offsetExpiresSec[,
890905 - empty string for no value
891906 - ` $now$ ` keyword for setting current time in ms, e.g 1667915146503
892907 - ` $currentDate$ ` keyword for setting current time as string, e.g 'Tue Nov 08 2022 13:53:19 GMT+0300'
908+ - ` $currentISODate$ ` keyword for setting current date in the date time string format,
909+ e.g '2022-11-08T13:53:19.650Z'
893910- ` offsetExpiresSec ` — optional, offset from current time in seconds, after which cookie should expire;
894911 defaults to no offset. Possible values:
895912 - positive integer in seconds
@@ -966,6 +983,8 @@ example.com#%#//scriptlet('trusted-set-local-storage-item', 'key', 'value')
966983 - ` $now$ ` keyword for setting current time in ms, corresponds to ` Date.now() ` and ` (new Date).getTime() ` calls
967984 - ` $currentDate$ ` keyword for setting string representation of the current date and time,
968985 corresponds to ` Date() ` and ` (new Date).toString() ` calls
986+ - ` $currentISODate$ ` keyword for setting current date in the date time string format,
987+ corresponds to ` (new Date).toISOString() ` call, e.g '2022-11-08T13:53:19.650Z'
969988
970989### Examples
971990
@@ -1003,6 +1022,68 @@ example.com#%#//scriptlet('trusted-set-local-storage-item', 'key', 'value')
10031022
10041023* * *
10051024
1025+ ## <a id="trusted-set-session-storage-item"></a> ⚡️ trusted-set-session-storage-item
1026+
1027+ > Added in v1.11.16.
1028+
1029+ Adds item with arbitrary key and value to sessionStorage object, or updates the value of the key if it already exists.
1030+ Scriptlet won't set item if storage is full.
1031+
1032+ ### Syntax
1033+
1034+ ```adblock
1035+ example.com#%#//scriptlet('trusted-set-session-storage-item', 'key', 'value')
1036+ ```
1037+
1038+ - ` key ` — required, key name to be set.
1039+ - ` value ` — required, key value; possible values:
1040+ - arbitrary value
1041+ - ` $now$ ` keyword for setting current time in ms, corresponds to ` Date.now() ` and ` (new Date).getTime() ` calls
1042+ - ` $currentDate$ ` keyword for setting string representation of the current date and time,
1043+ corresponds to ` Date() ` and ` (new Date).toString() ` calls
1044+ - ` $currentISODate$ ` keyword for setting current date in the date time string format,
1045+ corresponds to ` (new Date).toISOString() ` call, e.g '2022-11-08T13:53:19.650Z'
1046+
1047+ ### Examples
1048+
1049+ 1 . Set session storage item
1050+
1051+ <!-- markdownlint-disable line-length -->
1052+
1053+ ``` adblock
1054+ example.org#%#//scriptlet('trusted-set-session-storage-item', 'player.live.current.mute', 'false')
1055+
1056+ example.org#%#//scriptlet('trusted-set-session-storage-item', 'COOKIE_CONSENTS', '{"preferences":3,"flag":false}')
1057+
1058+ example.org#%#//scriptlet('trusted-set-session-storage-item', 'providers', '[16364,88364]')
1059+
1060+ example.org#%#//scriptlet('trusted-set-session-storage-item', 'providers', '{"providers":[123,456],"consent":"all"}')
1061+ ```
1062+
1063+ <!-- markdownlint-enable line-length -->
1064+
1065+ 1. Set item with current time since unix epoch in ms
1066+
1067+ ```adblock
1068+ example.org#%#//scriptlet('trusted-set-session-storage-item', 'player.live.current.play', '$now$')
1069+ ```
1070+
1071+ 1. Set item with current date, e.g 'Tue Nov 08 2022 13:53:19 GMT+0300'
1072+
1073+ ```adblock
1074+ example.org#%#//scriptlet('trusted-set-session-storage-item', 'player.live.current.play', '$currentDate$')
1075+ ```
1076+
1077+ 1. Set item without value
1078+
1079+ ```adblock
1080+ example.org#%#//scriptlet('trusted-set-session-storage-item', 'ppu_main_none', '')
1081+ ```
1082+
1083+ [Scriptlet source](../src/scriptlets/trusted-set-session-storage-item.ts)
1084+
1085+ * * *
1086+
10061087## <a id="trusted-suppress-native-method"></a> ⚡️ trusted-suppress-native-method
10071088
10081089> Added in v1.10.25.
0 commit comments