Using special keys for keybidings in Javascript

Posted by newhen on Stack Overflow See other posts from Stack Overflow or by newhen
Published on 2010-06-01T03:47:35Z Indexed on 2010/06/01 3:53 UTC
Read the original article Hit count: 448

Hi, I was wondering if it was possible to use special keys that the macbook pro has for music control and bind them in javascript? Example keys: PLay/pause,next, back.

I am trying to do this to modify a greasemonkey script if that helps.

Here is the current code

HotKeys.bindings['/'] = HotKeys.activateSearch;
HotKeys.bindings['p'] = HotKeys.playPrev;
HotKeys.bindings['n'] = HotKeys.playNext;
HotKeys.bindings['k'] = HotKeys.selectPrev;
HotKeys.bindings['j'] = HotKeys.selectNext;
HotKeys.bindings['o'] = HotKeys.playSelected;
HotKeys.bindings['v'] = HotKeys.openBlog;
HotKeys.bindings['s'] = HotKeys.toggleFavorite; 

HotKeys.keyBindings[27] /*ESC*/ = HotKeys.deactivateSearch;

Script source: http://userscripts.org/scripts/review/23612

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about greasemonkey