GM.info: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Added space and line (horizontal rule) to increase clarity/comprehension.
mNo edit summary
Line 3: Line 3:


An object that exposes various information about Greasemonkey and the running User Script.
An object that exposes various information about Greasemonkey and the running User Script.


Compatibility: [[Version_history#0.9.16|Greasemonkey 0.9.16+]]
Compatibility: [[Version_history#0.9.16|Greasemonkey 0.9.16+]]
Line 23: Line 22:
; version
; version
: The version of Greasemonkey, a string e.g. <tt>0.9.16</tt>.
: The version of Greasemonkey, a string e.g. <tt>0.9.16</tt>.
<br />
 
----
----



Revision as of 14:09, 11 February 2012

Description

An object that exposes various information about Greasemonkey and the running User Script.

Compatibility: Greasemonkey 0.9.16+

Syntax

GM_info

Returns

This object has the following properties:

script
An object containing data about the currently running script. See more detail below.
scriptMetaStr
A string, the entire literal Metadata Block (without the delimiters) for the currently running script.
scriptWillUpdate
A boolean; when true Greasemonkey will attempt to auto-update the script.
version
The version of Greasemonkey, a string e.g. 0.9.16.

The script object contains structured fields from the Metadata Block:

description
Possibly empty string.
excludes
Possibly empty array of strings.
includes
Possibly empty array of strings.
matches
Possibly empty array of strings. (Bug in 0.9.16.)
name
String.
namespace
Possibly empty string.
run-at
String.
unwrap
Boolean.
version
Possibly empty string.