Difference between revisions of "GM.registerMenuCommand"

From GreaseSpot Wiki
Jump to navigationJump to search
m (Text replace - "top | back'' " to "")
m (Text replace - "top | back" to "")
Line 42: Line 42:
:* Function to call
:* Function to call


[[#top|top]] | [[#Syntax|back]]
 


==== <code>accelKey</code> ====
==== <code>accelKey</code> ====
Line 50: Line 50:
:* A single character or keycode that can trigger the command.
:* A single character or keycode that can trigger the command.


[[#top|top]] | [[#Syntax|back]]
 


==== <code>accelModifiers</code> ====
==== <code>accelModifiers</code> ====
Line 58: Line 58:
:* A string listing modifiers that must be pressed with the [[#accelKey|accelKey]]. If there's more than one, then they should be separated with spaces. Available modifiers are: shift, alt, meta, control, and accel.
:* A string listing modifiers that must be pressed with the [[#accelKey|accelKey]]. If there's more than one, then they should be separated with spaces. Available modifiers are: shift, alt, meta, control, and accel.


[[#top|top]] | [[#Syntax|back]]
 


==== <code>accessKey</code> ====
==== <code>accessKey</code> ====
Line 66: Line 66:
:* A single character that can be used to jump to the command when the menu is open. It should be a letter in [[#commandName|commandName]].
:* A single character that can be used to jump to the command when the menu is open. It should be a letter in [[#commandName|commandName]].


[[#top|top]] | [[#Syntax|back]]
 


== Examples ==
== Examples ==

Revision as of 17:47, 3 February 2010


Description

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

Syntax

GM_registerMenuCommand( commandName, commandFunc, accelKey, accelModifiers, accessKey )

Value: Function
Returns: undefined
Compatibility: Greasemonkey 0.2.5+
Parameters
Properties Event Handlers
commandName commandFunc
accelKey
accelModifiers
accessKey

Properties


commandName

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


commandFunc

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


accelKey

Value: String
Usage: accelKey = "g";
  • A single character or keycode that can trigger the command.


accelModifiers

Value: String
Usage: accelModifiers = "control alt";
  • 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

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

Template:Samp

Template:Samp

Template:Samp