https://github.com/robhurring/prototype-keypress_observer
Javascript Prototype based keypress observer monitors a document's keypresses and if they match the specified combo it calls the callback.
https://github.com/robhurring/prototype-keypress_observer
Last synced: 10 months ago
JSON representation
Javascript Prototype based keypress observer monitors a document's keypresses and if they match the specified combo it calls the callback.
- Host: GitHub
- URL: https://github.com/robhurring/prototype-keypress_observer
- Owner: robhurring
- Created: 2009-01-27T23:15:03.000Z (over 17 years ago)
- Default Branch: master
- Last Pushed: 2009-02-14T22:49:52.000Z (over 17 years ago)
- Last Synced: 2024-04-13T19:19:39.183Z (over 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 82 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
=About
Keypress observer monitors a document's keypress event issues a callback if it matches our specified key combo.
It supports multiple modifier keys and can be set to _specific_ key combinations in a more human-readable format.
Author:: Rob Hurring
Homepage:: http://github.com/robhurring
Date:: 1/27/09
=Options
Keypress.observe accepts:
shift:: we want the SHIFT key down
alt:: we want the ALT key down
control:: we want the CTRL key down
meta:: we want the META key down
=Usage
// monitor ctrl-shift-G
new Keypress.observe(Ansi.G, function(e)
{
alert('Do something');
},{shift:true, control:true});
// monitor ctrl-meta-shift-P
new Keypress.observe(Ansi.P, function(e)
{
print_document();
}, {control:true, meta:true, shift:true});
=Dependencies
written against Prototype 1.6.0.1