Add-on Documentation

Gear add-on engine is a new high-performance mobile Userscript engine that is compatible with Tampermonkey and Greasemonkey Userscript.

The basic Userscript demo

// ==UserScript==
// @name         {{name}}
// @version      0.1
// @description  New Userscript
// @author       You
// @match        *
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...

Userscript headers

Grant List


The shadow window object for full access to the page's JavaScript functions and variables.

Gear provides a high-performance storage engine. You save your script data here. It's standalone with the website and will be cleared up when the script is uninstalled. You can use those functions to save and delete data from the storage.
Set value to the storage.

GM_setValue(name, value) : void
GM.setValue(name, value) : Promise
Get value from the storage. You can provide a default value if nothing is found from the storage.

GM_getValue(name, defaultValue) : any
GM.getValue(name, defaultValue) : Promise
Delete a value from the storage.

GM_deleteValue(name) : void
GM.deleteValue(name) : Promise
List all values from the storage.

GM_listValues() : array
GM.listValues() : Promise
Add a value listener to detect value change, and return the listenerId that you can remove it by calling GM_removeValueChangeListener(listenerId).
GM_addValueChangeListener(name, function(name, oldValue, newValue, isRemote)) : string
Remove the value listener by listenerId.
Insert a new CSS style to head element.

GM_addStyle(style) : void
GM.addStyle(style) : void
Insert a new element to the document or parent node, and returns the element itself.

GM_addElement(parentNode, tagName, attributes) : node
GM_addElement(tagName, attributes) : node

GM_addElement('script', {
    src: '',
    type: 'text/javascript'

        src: '',
        type: 'text/javascript'
Output log message to the console.

GM_log(message) : void
GM.log(message) : void
Get the raw content predefined from @resource.
GM_getResourceText(name) : String
Get the base64 encoded URI predefined from @resource.

GM_getResourceURL(name) : any
GM.getResourceUrl(name) : Promise
Register a menu command that can access from the running add-on menu.

GM_registerMenuCommand(name, fn, accessKey) : int
GM.registerMenuCommand(name, fn, accessKey) : int
Unregister the menu command by its id.

GM_unregisterMenuCommand(id) : void
GM.unregisterMenuCommand(id) : void
Open a new tab with options.

GM_openInTab(url, options) : TabObject
GM_openInTab(url, loadInBackground) : TabObject

TabObject = {'closed': Bool, 'onclose': Function, 'close': Function}
Create a new xmlHttpRequest.

GM_xmlHttpRequest(options) : void
GM.xmlHttpRequest(options) : void
Create a new download task.
GM_download(options), GM_download(url, name) : void
Set value to the clipboard.

GM_setClipboard(data, info = 'text|html') : void
GM.setClipboard(data, info = 'text|html') : void
Get the tab object.

// This function is unsupported.
Save the tab object.

// This function is unsupported.
Send notification.

// This function is unsupported.
Get script information.


    "script": [
        "uuid": string,
        "name": string,
        "author": string,
        "description": string,
        "namespace": string,
        "homepage": string,
        "version": string,
        "icon": string,
        "icon64": string,
        "excludes": array,
        "includes": array,
        "matches": array,
        "requires": array,
        "resources": object,
        "run-at": string,
        "updateURL": string,
        "downloadURL": string,
        "supportURL": string,
    "downloadMode": string = native,
    "scriptMetaStr": string,
    "scriptSource": string,
    "scriptUpdateURL": string,
    "scriptHandler": string = Tampermonkey,
    "isIncognito": bool,
    "version": string

Compatibility Issues for iOS

On iOS, all web browser render engines are using the WKWebView framework based on WebKit for displaying web content. That means all web browsers on iOS including Safari, will have the same JavaScript engine for running JavaScript code. Although WKWebView and desktop browsers like Chrome, and Microsoft Edge are WebKit based that Userscript can run on Gear just like a desktop without having significant modification, there are still some different compatibility issues that need to check out.