Reference for violentmonkey: https://violentmonkey.github.io/api/gm/#gm_info Reference for greasymonkey api: https://wiki.greasespot.net/Greasemonkey_Manual:API
Types
GmInfo = object uuid*: cstring scriptMetaStr*: cstring scriptWillUpdate*: bool scriptHandler*: cstring version*: cstring platform*: GmInfoPlatform
- All data returned from GM.info()
GmInfoArch = enum arm, mips, mips64, `x86 - 32`, `x86 - 64`
- The possible architectures
GmInfoOs = enum android, cros, linux, mac, openbsd, win
- The possible operating systems
GmInfoPlatform = object arch*: GmInfoArch browserName*: cstring browserVersion*: cstring os*: GmInfoOs
- The information about the client platform
Vars
unsafeWindow: dom.Window
- This object provides access to the raw JavaScript window scope of the content page. It is most commonly used to access JavaScript variables on the page.
Procs
proc info(gm: GmType): GmInfo {...}{.importcpp.}
- NOT WORKING Exposes this information (plus a bit more) to the user script.
proc getValue(gm: GmType; key, defaultValue: cstring): Future[cstring] {...}{. codegenDecl: "async function $2($3)", importcpp, importcpp.}
- Retrieves stored values, see GM.setValue below.
proc setValue(gm: GmType; key, value: cstring): Future[void] {...}{. codegenDecl: "async function $2($3)", importcpp, importcpp.}
- Permanently stores a value under a key, later available via GM.getValue.
proc deleteValue(gm: GmType; key: cstring): Future[void] {...}{. codegenDecl: "async function $2($3)", importcpp, importcpp.}
- Deletes a value from chrome that was previously set.
proc listValues(gm: GmType): Future[seq[cstring]] {...}{. codegenDecl: "async function $2($3)", importcpp, importcpp.}
- Retrieves an array of stored values' keys.
proc openInTab(gm: GmType; url: cstring; openInBackground = false) {...}{.importcpp.}
- Opens a given URL in a new tab.
proc registerMenuCommand(gm: GmType; caption: cstring; commandFunc: Callable; accessKey: cstring) {...}{.importcpp.}
- Adds an item to the "User Script Commands" section of the Monkey Menu.
proc setClipboard(gm: GmType; text: cstring) {...}{.importcpp.}
- Sets the contents of the clipboard.
proc notification(gm: GmType; text: cstring; title, image = "".cstring; onclick, ondone: Callable = notification_placeholderCallback)
- Opens a notification dialog.
proc xmlHttpRequest(gm: GmType; url, method: cstring; binary = false; context = newJsObject(); data = "".cstring; headers: openArray[(string, string)] = []; overrideMimeType, user, password = "".cstring; synchronous = false; timeout = 0; upload = newJsObject(); onabort, onerror, onload, onprogress, onreadystatechange, ontimeout: GmHttpResponse = xmlHttpRequest_placeholderCallback)
- A variant of XMLHttpRequest, this method allows skipping use the same-origin policy, enabling complex mashups.