GM_registerMenuCommand
From GreaseSpot
Contents |
[edit] Description
This method allows user scripts to add an item to the User Script Commands menu.
Compatibility: Greasemonkey 0.2.5+
[edit] Syntax
function GM_registerMenuCommand( caption, commandFunc, accelKey, accelModifiers, accessKey )
[edit] Arguments
-
caption -
StringThe caption to display on the menu item. -
commandFunc -
FunctionThe function to call when this menu item is selected by the user. -
accelKey -
StringDetails/verification needed! A single character or keycode that can trigger the command. -
accelModifiers -
StringDetails/verification needed! A string listing modifiers that must be pressed with theaccelKey. If there's more than one, then they should be separated with spaces. Available modifiers are: shift, alt, meta, control, and accel. -
accessKey -
StringDetails/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 thecaption.
[edit] Returns
undefined
[edit] 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");

