1

我想知道是否可以使用 macbook pro 用于音乐控制的特殊键并将它们绑定到 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

4

1 回答 1

0

只需将按键事件侦听器应用于文档并将事件记录到控制台,以便您查看它是否已注册。与此类似:http ://unixpapa.com/js/testkey.html

于 2011-06-21T19:34:49.663 回答