Keymaster is a simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. Keymaster has no dependencies and can be used completely standalone. It should not interfere with any JavaScript libraries or frameworks.
Keymaster understands the following modifiers:
⇧
, shift
, option
, ⌥
, alt
, ctrl
, control
, command
, and ⌘
.
The following special keys can be used for shortcuts:
backspace
, tab
, clear
, enter
, return
, esc
, escape
, space
,
up
, down
, left
, right
, home
, end
, pageup
, pagedown
, del
, delete
and f1
through f19
.
When an INPUT
, SELECT
or TEXTAREA
element is focused, Keymaster doesn’t process shortcuts.
Keymaster should work with any browser that fires keyup
and keydown
events, and is tested with IE (6+), Safari, Firefox and Chrome.
See http://madrobby.github.com/keymaster/ for a live demo. (Look at your firebug console)
https://github.com/madrobby/keymaster