From b9d3e13a281b586c31e064606403f4482753e7db Mon Sep 17 00:00:00 2001 From: Kurbanali Ruslan Date: Mon, 23 Dec 2024 14:55:07 +0500 Subject: [PATCH 1/6] updated docs --- docs/general/extensions.md | 134 +++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/docs/general/extensions.md b/docs/general/extensions.md index 0f85a6bb1a5..a773a79a7a6 100644 --- a/docs/general/extensions.md +++ b/docs/general/extensions.md @@ -160,6 +160,7 @@ unsafeWindow GM_getResourceText GM_addStyle GM_log +GM_addElement ``` [Here](https://wiki.greasespot.net/GM.info) you can find more information about Greasemonkey API. @@ -196,6 +197,7 @@ GM_log // @grant GM_info // @grant GM_openInTab // @grant GM_registerMenuCommand +// @grant GM_addElement // @run-at document-start // ==/UserScript== !function(){( @@ -203,6 +205,138 @@ GM_log )}(); ``` +#### Trusted Types Policy API + +AdGuard provides an instance of class `PolicyApi` that allows you to manage Trusted Types in your userscripts. +It's useful when your userscript is running on websites that requires Trusted Types. + +You can access instance of this class by using `ADG_policyApi` variable in your userscript. + +##### Properties + +- `name: string` - Name of the policy (Default is `"AGPolicy"`). +- `isSupported: boolean` - Flag that indicates is Trusted Types API supported or not in the current browser. + +##### Polyfilled methods + +- [`ADG_policyApi.createHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createHTML). If not supported returns `input: string` back. +- [`ADG_policyApi.createScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScript). If not supported returns `input: string` back. +- [`ADG_policyApi.createScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScriptURL). If not supported returns `input: string` back. +- [`ADG_policyApi.getAttributeType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType). If not supported returns `null`. +- [`ADG_policyApi.getPropertyType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType). If not supported returns `null`. +- [`ADG_policyApi.isHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML). If not supported returns `false`. +- [`ADG_policyApi.isScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScript). If not supported returns `false`. +- [`ADG_policyApi.isScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL). If not supported returns `false`. + +##### Additional Types + +```typescript +/** + * Enum representation of return values of `getAttributeType` and + * `getPropertyType` methods of native Trusted Types API. + * + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType} + */ +enum TrustedType { + HTML = 'TrustedHTML', + Script = 'TrustedScript', + ScriptURL = 'TrustedScriptURL', +} + +// You can access it like that inside of userscript +ADG_TrustedType.HTML // "TrustedHTML" + +/** + * Isomorphic trusted value type, if browser supports Trusted Types API it will be one of the + * `TrustedHTML`, `TrustedScript` or `TrustedScriptURL`, otherwise it will be regular `string`. + * + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedScript} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedScriptURL} + */ +type TrustedValue = string | TrustedHTML | TrustedScript | TrustedScriptURL; +``` + +##### Additional methods + +```typescript +/** + * Creates Trusted Type depending on `type`: + * - `TrustedHTML` + * - `TrustedScript` + * - `TrustedScriptURL` + * - or returns back `value` if none of them applicable. + * + * @param type Trusted Type. + * @param value Value from which creates Trusted Type. + * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. + * @returns Created value. + */ +function create( + type: TrustedType, + value: string, + ...createArgs: unknown[] +): TrustedValue + + +// Example: Creates TrustedHTML +const trustedHTML = ADG_policyApi.create(ADG_TrustedType.HTML, '
'); + +/** + * Converts `value` of `attribute` into one of the Trusted Types: + * - `TrustedHTML` + * - `TrustedScript` + * - `TrustedScriptURL` + * - or returns back `value` if none of them applicable. + * + * @param tagName Name of an HTML tag. + * @param attribute Attribute. + * @param value Value of attribute that needs to be converted. + * @param elementNS Element namespace, if empty defaults to the HTML namespace. + * @param attrNS Attribute namespace, if empty defaults to null. + * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. + * @returns Converted value. + */ +function convertAttributeToTrusted( + tagName: string, + attribute: string, + value: string, + elementNS?: string, + attrNS?: string, + ...createArgs: unknown[] +): TrustedValue + +// Example: Converts to TrustedScriptURL +const trustedScriptURL = ADG_policyApi.convertAttributeToTrusted("script", "src", 'SOME_URL'); +scriptElement.setAttribute("src", trustedScriptURL); + +/** + * Converts `value` of `property` into one of the Trusted Types: + * - `TrustedHTML` + * - `TrustedScript` + * - `TrustedScriptURL` + * - or returns back `value` if none of them applicable. + * + * @param tagName Name of an HTML tag. + * @param property Property. + * @param value Value or property. + * @param elementNS Element namespace, if empty defaults to the HTML namespace. + * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. + * @returns Converted value. + */ +function convertPropertyToTrusted( + tagName: string, + property: string, + value: string, + elementNS?: string, + ...createArgs: unknown[] +): TrustedValue + +// Example: Converts to TrustedHTML +divElement.innerHTML = ADG_policyApi.convertPropertyToTrusted("div", "innerHTML", "
"); +``` + ## Userstyles Userstyles allow users to change the appearance of popular websites. From 4b9a4467a5814b0aad2dddbfb1655afa4f8747d1 Mon Sep 17 00:00:00 2001 From: Kurbanali Ruslan Date: Mon, 23 Dec 2024 17:17:36 +0500 Subject: [PATCH 2/6] added links to API --- docs/general/extensions.md | 131 ++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 69 deletions(-) diff --git a/docs/general/extensions.md b/docs/general/extensions.md index a773a79a7a6..80b27ac8969 100644 --- a/docs/general/extensions.md +++ b/docs/general/extensions.md @@ -93,77 +93,62 @@ If you are developing your own userscript and want to test how it works with AdG #### Compatibility -#### Metadata block - -#### Supported properties - -```text -@name -@namespace -@description -@version -@match -@include -@exclude -@grant -@connect -@require -@resource -@downloadURL -@updateURL -@supportURL -@homepageURL -@homepage -@website -@source -@run-at -@noframes -@icon -@iconURL -@defaulticon -@icon64 -@icon64URL -``` - -#### Unsupported properties +##### Metadata block + +###### Supported properties + +- [`@name`](https://wiki.greasespot.net/Metadata_Block#@name) +- [`@namespace`](https://wiki.greasespot.net/Metadata_Block#@namespace) +- [`@description`](https://wiki.greasespot.net/Metadata_Block#@description) +- [`@version`](https://wiki.greasespot.net/Metadata_Block#@version) +- [`@match`](https://wiki.greasespot.net/Metadata_Block#@match) +- [`@include`](https://wiki.greasespot.net/Metadata_Block#@include) +- [`@exclude`](https://wiki.greasespot.net/Metadata_Block#@exclude) +- [`@grant`](https://wiki.greasespot.net/Metadata_Block#@grant) +- [`@connect`](https://www.tampermonkey.net/documentation.php#meta:connect) +- [`@require`](https://wiki.greasespot.net/Metadata_Block#@require) +- [`@resource`](https://wiki.greasespot.net/Metadata_Block#@resource) +- [`@downloadURL`](https://www.tampermonkey.net/documentation.php#meta:downloadURL) +- [`@updateURL`](https://www.tampermonkey.net/documentation.php#meta:updateURL) +- [`@homepage`, `@homepageURL`, `@source`, `@website`](https://www.tampermonkey.net/documentation.php#meta:homepage) +- [`@run-at`](https://wiki.greasespot.net/Metadata_Block#@run-at) +- [`@noframes`](https://wiki.greasespot.net/Metadata_Block#@noframes) +- [`@icon`, `@iconURL`, `@defaulticon`](https://www.tampermonkey.net/documentation.php#meta:icon) +- [`@icon64`, `@icon64URL`](https://www.tampermonkey.net/documentation.php#meta:icon64) + +###### Unsupported properties These properties will be simply ignored by AdGuard. -```text -@unwrap -``` +- [`@unwrap`](https://www.tampermonkey.net/documentation.php#meta:unwrap) -#### Supported GM functions +##### Supported GM functions AdGuard supports both old GM\_ functions and new GM4 API that use GM object. -#### Values - :::note All listed old Greasemonkey functions are deprecated but still supported. ::: -```text -GM.info / GM_info -GM.setValue / GM_setValue -GM.getValue / GM_getValue -GM.listValues / GM_listValues -GM.deleteValue / GM_deleteValue -GM.getResourceUrl / GM_getResourceURL -GM.setClipboard / GM_setClipboard -GM.xmlHttpRequest / GM_xmlhttpRequest -GM.openInTab / GM_openInTab -GM.notification -unsafeWindow -GM_getResourceText -GM_addStyle -GM_log -GM_addElement -``` - -[Here](https://wiki.greasespot.net/GM.info) you can find more information about Greasemonkey API. +- [`GM.info`, `GM_info`](https://wiki.greasespot.net/GM.info) +- [`GM.setValue`, `GM_setValue`](https://wiki.greasespot.net/GM.setValue) +- [`GM.getValue`, `GM_getValue`](https://wiki.greasespot.net/GM.getValue) +- [`GM.listValues`, `GM_listValues`](https://wiki.greasespot.net/GM.listValues) +- [`GM.deleteValue`, `GM_deleteValue`](https://wiki.greasespot.net/GM.deleteValue) +- [`GM.getResourceUrl`, `GM_getResourceURL`](https://wiki.greasespot.net/GM.getResourceUrl) +- [`GM.setClipboard`, `GM_setClipboard`](https://wiki.greasespot.net/GM.setClipboard) +- [`GM.xmlHttpRequest`, `GM_xmlhttpRequest`](https://wiki.greasespot.net/GM.xmlHttpRequest) +- [`GM.openInTab`, `GM_openInTab`](https://wiki.greasespot.net/GM.openInTab) +- [`GM.notification`](https://wiki.greasespot.net/GM.notification) +- [`unsafeWindow`](https://wiki.greasespot.net/UnsafeWindow) +- [`GM_getResourceText`](https://www.tampermonkey.net/documentation.php#api:GM_getResourceText) +- [`GM_addStyle`](https://www.tampermonkey.net/documentation.php#api:GM_addStyle) +- [`GM_log`](https://www.tampermonkey.net/documentation.php#api:GM_log) +- [`GM.addElement`, `GM_addElement`](https://www.tampermonkey.net/documentation.php#api:GM_addElement) + +[Here](https://wiki.greasespot.net/Greasemonkey_Manual:API) you can find more information about Greasemonkey API. #### Example @@ -198,7 +183,7 @@ GM_addElement // @grant GM_openInTab // @grant GM_registerMenuCommand // @grant GM_addElement -// @run-at document-start +// @run-at document-start // ==/UserScript== !function(){( console.log("I am loaded!"); @@ -207,8 +192,7 @@ GM_addElement #### Trusted Types Policy API -AdGuard provides an instance of class `PolicyApi` that allows you to manage Trusted Types in your userscripts. -It's useful when your userscript is running on websites that requires Trusted Types. +AdGuard provides an instance of `PolicyApi` class that allows you to manage Trusted Types in your userscripts. You can access instance of this class by using `ADG_policyApi` variable in your userscript. @@ -219,14 +203,23 @@ You can access instance of this class by using `ADG_policyApi` variable in your ##### Polyfilled methods -- [`ADG_policyApi.createHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createHTML). If not supported returns `input: string` back. -- [`ADG_policyApi.createScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScript). If not supported returns `input: string` back. -- [`ADG_policyApi.createScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScriptURL). If not supported returns `input: string` back. -- [`ADG_policyApi.getAttributeType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType). If not supported returns `null`. -- [`ADG_policyApi.getPropertyType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType). If not supported returns `null`. -- [`ADG_policyApi.isHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML). If not supported returns `false`. -- [`ADG_policyApi.isScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScript). If not supported returns `false`. -- [`ADG_policyApi.isScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL). If not supported returns `false`. +- [`ADG_policyApi.createHTML`]. If not supported returns `input: string` back. +- [`ADG_policyApi.createScript`]. If not supported returns `input: string` back. +- [`ADG_policyApi.createScriptURL`]. If not supported returns `input: string` back. +- [`ADG_policyApi.getAttributeType`]. If not supported returns `null`. +- [`ADG_policyApi.getPropertyType`]. If not supported returns `null`. +- [`ADG_policyApi.isHTML`]. If not supported returns `false`. +- [`ADG_policyApi.isScript`]. If not supported returns `false`. +- [`ADG_policyApi.isScriptURL`]. If not supported returns `false`. + +[`ADG_policyApi.createHTML`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createHTML +[`ADG_policyApi.createScript`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScript +[`ADG_policyApi.createScriptURL`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScriptURL +[`ADG_policyApi.getAttributeType`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType +[`ADG_policyApi.getPropertyType`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType +[`ADG_policyApi.isHTML`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML +[`ADG_policyApi.isScript`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScript +[`ADG_policyApi.isScriptURL`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL ##### Additional Types From ccb42869c930b21a32c907ac8cc7e569f547c03f Mon Sep 17 00:00:00 2001 From: Kurbanali Ruslan Date: Tue, 24 Dec 2024 11:56:48 +0500 Subject: [PATCH 3/6] review changes --- docs/general/extensions.md | 63 ++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/docs/general/extensions.md b/docs/general/extensions.md index 80b27ac8969..c2c40a428c8 100644 --- a/docs/general/extensions.md +++ b/docs/general/extensions.md @@ -148,7 +148,7 @@ All listed old Greasemonkey functions are deprecated but still supported. - [`GM_log`](https://www.tampermonkey.net/documentation.php#api:GM_log) - [`GM.addElement`, `GM_addElement`](https://www.tampermonkey.net/documentation.php#api:GM_addElement) -[Here](https://wiki.greasespot.net/Greasemonkey_Manual:API) you can find more information about Greasemonkey API. +You can find more information about Greasemonkey API in [its manual](https://wiki.greasespot.net/Greasemonkey_Manual:API) . #### Example @@ -192,41 +192,32 @@ All listed old Greasemonkey functions are deprecated but still supported. #### Trusted Types Policy API -AdGuard provides an instance of `PolicyApi` class that allows you to manage Trusted Types in your userscripts. +AdGuard provides an instance of the `PolicyApi` class that allows you to manage Trusted Types in your userscripts. -You can access instance of this class by using `ADG_policyApi` variable in your userscript. +You can access the instance of this class by using the `ADG_policyApi` variable in your userscript. ##### Properties -- `name: string` - Name of the policy (Default is `"AGPolicy"`). -- `isSupported: boolean` - Flag that indicates is Trusted Types API supported or not in the current browser. +- `name: string` — a name of the policy (Default is `"AGPolicy"`). +- `isSupported: boolean` — a flag indicating whether or not the Trusted Types API is supported by the current browser. ##### Polyfilled methods -- [`ADG_policyApi.createHTML`]. If not supported returns `input: string` back. -- [`ADG_policyApi.createScript`]. If not supported returns `input: string` back. -- [`ADG_policyApi.createScriptURL`]. If not supported returns `input: string` back. -- [`ADG_policyApi.getAttributeType`]. If not supported returns `null`. -- [`ADG_policyApi.getPropertyType`]. If not supported returns `null`. -- [`ADG_policyApi.isHTML`]. If not supported returns `false`. -- [`ADG_policyApi.isScript`]. If not supported returns `false`. -- [`ADG_policyApi.isScriptURL`]. If not supported returns `false`. - -[`ADG_policyApi.createHTML`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createHTML -[`ADG_policyApi.createScript`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScript -[`ADG_policyApi.createScriptURL`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScriptURL -[`ADG_policyApi.getAttributeType`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType -[`ADG_policyApi.getPropertyType`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType -[`ADG_policyApi.isHTML`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML -[`ADG_policyApi.isScript`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScript -[`ADG_policyApi.isScriptURL`]: https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL +- [`ADG_policyApi.createHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createHTML). If not supported, returns `input: string`. +- [`ADG_policyApi.createScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScript). If not supported, returns `input: string`. +- [`ADG_policyApi.createScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy/createScriptURL). If not supported, returns `input: string`. +- [`ADG_policyApi.getAttributeType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType). If not supported, returns `null`. +- [`ADG_policyApi.getPropertyType`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType). If not supported, returns `null`. +- [`ADG_policyApi.isHTML`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isHTML). If not supported, returns `false`. +- [`ADG_policyApi.isScript`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScript). If not supported, returns `false`. +- [`ADG_policyApi.isScriptURL`](https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/isScriptURL). If not supported, returns `false`. ##### Additional Types ```typescript /** - * Enum representation of return values of `getAttributeType` and - * `getPropertyType` methods of native Trusted Types API. + * Enum representation of the return values of the `getAttributeType` and + * `getPropertyType` methods of the native Trusted Types API. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getAttributeType} * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory/getPropertyType} @@ -241,8 +232,8 @@ enum TrustedType { ADG_TrustedType.HTML // "TrustedHTML" /** - * Isomorphic trusted value type, if browser supports Trusted Types API it will be one of the - * `TrustedHTML`, `TrustedScript` or `TrustedScriptURL`, otherwise it will be regular `string`. + * Isomorphic trusted value type. If a browser supports the Trusted Types API, it will be one of the enum Trusted Types + * (`TrustedHTML`, `TrustedScript` or `TrustedScriptURL`); otherwise, it will be regular `string`. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML} * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedScript} @@ -255,14 +246,14 @@ type TrustedValue = string | TrustedHTML | TrustedScript | TrustedScriptURL; ```typescript /** - * Creates Trusted Type depending on `type`: + * Creates a Trusted Type depending on `type`: * - `TrustedHTML` * - `TrustedScript` * - `TrustedScriptURL` - * - or returns back `value` if none of them applicable. + * - or returns `value` if none of them is applicable. * * @param type Trusted Type. - * @param value Value from which creates Trusted Type. + * @param value Value from which a Trusted Type is created. * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. * @returns Created value. */ @@ -281,13 +272,13 @@ const trustedHTML = ADG_policyApi.create(ADG_TrustedType.HTML, '
'); * - `TrustedHTML` * - `TrustedScript` * - `TrustedScriptURL` - * - or returns back `value` if none of them applicable. + * - or returns `value` if none of them is applicable. * * @param tagName Name of an HTML tag. * @param attribute Attribute. - * @param value Value of attribute that needs to be converted. - * @param elementNS Element namespace, if empty defaults to the HTML namespace. - * @param attrNS Attribute namespace, if empty defaults to null. + * @param value Value of an attribute to be converted. + * @param elementNS Element namespace. If empty, defaults to the HTML namespace. + * @param attrNS Attribute namespace. If empty, defaults to null. * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. * @returns Converted value. */ @@ -309,12 +300,12 @@ scriptElement.setAttribute("src", trustedScriptURL); * - `TrustedHTML` * - `TrustedScript` * - `TrustedScriptURL` - * - or returns back `value` if none of them applicable. + * - or returns `value` if none of them is applicable. * * @param tagName Name of an HTML tag. * @param property Property. - * @param value Value or property. - * @param elementNS Element namespace, if empty defaults to the HTML namespace. + * @param value Value of a property to be converted. + * @param elementNS Element namespace. If empty, defaults to the HTML namespace. * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. * @returns Converted value. */ From 9d902a0caeb743a803c57d5d7b35d02e710c6eec Mon Sep 17 00:00:00 2001 From: Kurbanali Ruslan Date: Tue, 24 Dec 2024 12:34:47 +0500 Subject: [PATCH 4/6] removed extra space --- docs/general/extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/extensions.md b/docs/general/extensions.md index c2c40a428c8..ebe74c4ac5c 100644 --- a/docs/general/extensions.md +++ b/docs/general/extensions.md @@ -148,7 +148,7 @@ All listed old Greasemonkey functions are deprecated but still supported. - [`GM_log`](https://www.tampermonkey.net/documentation.php#api:GM_log) - [`GM.addElement`, `GM_addElement`](https://www.tampermonkey.net/documentation.php#api:GM_addElement) -You can find more information about Greasemonkey API in [its manual](https://wiki.greasespot.net/Greasemonkey_Manual:API) . +You can find more information about Greasemonkey API in [its manual](https://wiki.greasespot.net/Greasemonkey_Manual:API). #### Example From 5a8d76c7c4a8137e7bd35585bb0024322c597501 Mon Sep 17 00:00:00 2001 From: Kurbanali Ruslan Date: Tue, 24 Dec 2024 12:39:51 +0500 Subject: [PATCH 5/6] renamed header --- docs/general/extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/extensions.md b/docs/general/extensions.md index ebe74c4ac5c..8dfa4c5d131 100644 --- a/docs/general/extensions.md +++ b/docs/general/extensions.md @@ -190,7 +190,7 @@ You can find more information about Greasemonkey API in [its manual](https://wik )}(); ``` -#### Trusted Types Policy API +#### Trusted Types API AdGuard provides an instance of the `PolicyApi` class that allows you to manage Trusted Types in your userscripts. From e026286ac22b8e002bc9382c83472198c5b774d3 Mon Sep 17 00:00:00 2001 From: Kurbanali Ruslan Date: Tue, 24 Dec 2024 16:35:05 +0500 Subject: [PATCH 6/6] changed formatting of jsdoc --- docs/general/extensions.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/general/extensions.md b/docs/general/extensions.md index 8dfa4c5d131..c08858dee0b 100644 --- a/docs/general/extensions.md +++ b/docs/general/extensions.md @@ -252,10 +252,10 @@ type TrustedValue = string | TrustedHTML | TrustedScript | TrustedScriptURL; * - `TrustedScriptURL` * - or returns `value` if none of them is applicable. * - * @param type Trusted Type. - * @param value Value from which a Trusted Type is created. - * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. - * @returns Created value. + * @param type Trusted Type. + * @param value Value from which a Trusted Type is created. + * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. + * @returns Created value. */ function create( type: TrustedType, @@ -274,13 +274,13 @@ const trustedHTML = ADG_policyApi.create(ADG_TrustedType.HTML, '
'); * - `TrustedScriptURL` * - or returns `value` if none of them is applicable. * - * @param tagName Name of an HTML tag. - * @param attribute Attribute. - * @param value Value of an attribute to be converted. - * @param elementNS Element namespace. If empty, defaults to the HTML namespace. - * @param attrNS Attribute namespace. If empty, defaults to null. - * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. - * @returns Converted value. + * @param tagName Name of an HTML tag. + * @param attribute Attribute. + * @param value Value of an attribute to be converted. + * @param elementNS Element namespace. If empty, defaults to the HTML namespace. + * @param attrNS Attribute namespace. If empty, defaults to null. + * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. + * @returns Converted value. */ function convertAttributeToTrusted( tagName: string, @@ -302,12 +302,12 @@ scriptElement.setAttribute("src", trustedScriptURL); * - `TrustedScriptURL` * - or returns `value` if none of them is applicable. * - * @param tagName Name of an HTML tag. - * @param property Property. - * @param value Value of a property to be converted. - * @param elementNS Element namespace. If empty, defaults to the HTML namespace. - * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. - * @returns Converted value. + * @param tagName Name of an HTML tag. + * @param property Property. + * @param value Value of a property to be converted. + * @param elementNS Element namespace. If empty, defaults to the HTML namespace. + * @param createArgs Additional arguments to be passed to the function represented by `TrustedTypePolicy`. + * @returns Converted value. */ function convertPropertyToTrusted( tagName: string,