Skip to content

Commit 1260c92

Browse files
committed
doc: use TypeDetail to render from types
1 parent 7fe7227 commit 1260c92

File tree

1 file changed

+1
-86
lines changed

1 file changed

+1
-86
lines changed

content/pages/api/gm.mdx

+1-86
Original file line numberDiff line numberDiff line change
@@ -33,92 +33,7 @@ It is useful when [`@grant`](/api/metadata-block/#grant) is declared with anythi
3333

3434
### GM_info
3535

36-
An object that exposes information about the current userscript. It has following properties:
37-
38-
- <Field name="uuid" type="string" />
39-
40-
A unique ID of the script.
41-
42-
- <Field name="scriptMetaStr" type="string" />
43-
44-
The meta block of the script.
45-
46-
- <Field name="scriptWillUpdate" type="boolean" />
47-
48-
Whether the script will be updated automatically.
49-
50-
- <Field name="scriptHandler" type="string" />
51-
52-
The name of userscript manager, which should be the string `Violentmonkey`.
53-
54-
- <Field name="version" type="string" />
55-
56-
Version of Violentmonkey.
57-
58-
- <Field name="isIncognito" type="boolean" comment="since VM2.15.4" />
59-
60-
True when this is an incognito profile (Chrome) or private mode (Firefox).
61-
62-
- <Field name="platform" type="object" comment="since VM2.12.4" />
63-
64-
Unlike `navigator.userAgent`, which can be overridden by other extensions/userscripts or by devtools in device-emulation mode, `GM_info.platform` is more reliable as the data is obtained in the background page of Violentmonkey using a specialized extension API (browser.runtime.getPlatformInfo and getBrowserInfo).
65-
66-
- <Field name="arch" type="string" />
67-
68-
One of "arm", "mips", "mips64", "x86-32", "x86-64".
69-
70-
- <Field name="browserName" type="string" />
71-
72-
"chrome", "firefox" or whatever was returned by the API.
73-
74-
- <Field name="browserVersion" type="string" />
75-
76-
- <Field name="fullVersionList" type="{brand: string, version: string}[]" comment="since VM2.27.0" />
77-
78-
A safe copy from `navigator.userAgentData.getHighEntropyValues()` (Chromium 90+).
79-
80-
- <Field name="mobile" type="boolean" comment="since VM2.27.0" />
81-
82-
A safe copy from `navigator.userAgentData` (Chromium 90+).
83-
84-
- <Field name="os" type="string" />
85-
86-
One of "android", "cros", "linux", "mac", "openbsd", "win".
87-
88-
- <Field name="userAgent" type="string" comment="since VM2.20.2" />
89-
90-
A safe copy of `navigator.userAgent` from the content script of the extension, so it cannot be overridden by other extensions/userscripts, but unlike `GM_info.platform` it can be customized in devtools "device emulation" or "network conditions" for this tab.
91-
92-
- <Field name="userAgentData" type="object" comment="since VM2.20.2" />
93-
94-
A safe copy of `navigator.userAgentData` from the content script of the extension, so it cannot be overridden by other extensions/userscripts, but unlike `GM_info.platform` it can be customized in devtools "device emulation" or "network conditions" for this tab.
95-
96-
Only present if the browser actually implements it ([currently](https://caniuse.com/mdn-api_navigator_useragentdata) Chromium-based 90+), because there's no reliable/official polyfill.
97-
98-
- <Field name="brands" type="Array<{brand: string, version: string}>" />
99-
- <Field name="mobile" type="boolean" />
100-
- <Field name="platform" type="string" />
101-
- <Field name="getHighEntropyValues" type="(hints: string[]) => Promise<Object>" />
102-
103-
Violentmonkey implements the [official API](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData), including [getHighEntropyValues](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/getHighEntropyValues) function to obtain the extra info asynchronously.
104-
105-
- <Field name="script" type="object" />
106-
107-
Contains structured fields from the [Metadata Block](../metadata-block/):
108-
109-
- <Field name="description" type="string" />
110-
- <Field name="excludes" type="string[]" />
111-
- <Field name="includes" type="string[]" />
112-
- <Field name="matches" type="string[]" />
113-
- <Field name="name" type="string" />
114-
- <Field name="namespace" type="string" />
115-
- <Field name="resources" type="Array<{name, url}>" />
116-
- <Field name="runAt" type="string" />
117-
- <Field name="version" type="string" />
118-
119-
- <Field name="injectInto" type="string" comment="since VM2.10.0" />
120-
121-
The injection mode of current script. See [`@inject-into`](/api/metadata-block/#inject-into) for more information.
36+
<TypeDetail name="GM_info" />
12237

12338
### GM_getValue
12439

0 commit comments

Comments
 (0)