Menu

GM_registerMenuCommand

mmartz

Description

This API method allows user scripts to add a menu command to the "User Script Commands" submenu a.k.a the Monkey Menu.

| Examples | See Also | Notes

Syntax

GM_registerMenuCommand( commandName, commandFunc, accessKey )

Value: Function
Returns: undefined
Compatibility: Greasemonkey 0.2.5 - 3.12.0
Access: @grant

Parameters

Properties Event Handlers
commandName commandFunc
accessKey

Properties


commandName

Value: String
Usage: commandName = "Some Name";

commandFunc

Value: Function
Usage: commandFunc = function () { _/* some code */_ };

  • Function to call

accessKey

Value: String
Usage: accessKey = "g";

  • A single character that can be used to jump to the command when the menu is open. It should be a letter in commandName.

Examples

Core

GM_registerMenuCommand("Hello, world (simple)", helloSimple);

or

GM_registerMenuCommand("Hello, world!", hello, "h");

See Also

Notes


Related

Wiki: Greasemonkey_Manual:API
Wiki: Greasemonkey_Manual:Monkey_Menu
Wiki: Version_history

MongoDB Logo MongoDB