2010-06-01 52 views
1

我想知道是否有可能使用macbook pro用於音樂控制的特殊鍵並將它們綁定到javascript中? 示例鍵:PLAY/pause,next,back。在Javascript中使用特殊鍵的關鍵字

我試圖做到這一點修改一個greasemonkey腳本,如果有幫助。

下面是當前的代碼

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; 

腳本來源:http://userscripts.org/scripts/review/23612

回答