GM.registerMenuCommand

From GreaseSpot Wiki
Revision as of 10:16, 27 April 2010 by 85.179.134.228 (talk) (→‎Description: corrected typo)
Jump to navigationJump to search


Description

This method allows user scripts to add an item to the User Script Commands menu.

Compatibility: Greasemonkey 0.2.5+

Syntax

function GM_registerMenuCommand( caption, commandFunc, accelKey, accelModifiers, accessKey )

Arguments

caption
String The caption to display on the menu item.
commandFunc
Function The function to call when this menu item is selected by the user.
accelKey
String Details/verification needed! A single character or keycode that can trigger the command.
accelModifiers
String Details/verification needed! A string listing modifiers that must be pressed with the accelKey. If there's more than one, then they should be separated with spaces. Available modifiers are: shift, alt, meta, control, and accel.
accessKey
String Details/verification needed! A single character that can be used to jump to the command when the menu is open. It should be a letter in the caption.

Returns

undefined

Examples

GM_registerMenuCommand("Hello, world (simple)", helloSimple);
GM_registerMenuCommand("Hello, world!", hello, "e", "control", "h");
GM_registerMenuCommand("Hello, world! (again)", hello2, "e", "shift alt", "w");