Acunote Shortcuts is a JavaScript library providing everything you need to make add rich keyboard shortcut functionality to a web application. With a few lines of code you can have Gmail-like single and multi-key keyboard shortcuts covering the essential functionality.
Acunote Shortcuts was extracted from Acunote, an online project management application for Scrum, XP, Agile and common sense.
| j | has not been used yet |
| <Shift>+r | has not been used yet |
| g then i | has not been used yet |
| b then a then z | has not been used yet |
<script src="shortcuts.js" type="text/javascript"></script> <link href="shortcuts.css" type="text/css" media="screen"/>
<script type="text/javascript">
var SHORTCUTS = {
'h': function() { alert('Help!'); },
'f': {
'o': {
'o': function() { alert('"foo" has been typed!'); }
}
},
'b': {
'a': {
'R': function() { alert('"baR" has been typed!'); },
'z': function() { alert('"baz" has been typed!'); }
}
}
}
</script>
<body onload="shortcutListener.init();">
Rails helper supports global and page-specific keymaps and merges
these at runtime.
This way you can define global shortcuts for the
whole site in the layout, and modify them as needed for specific
pages. This example uses this functionality.
<%
@global_shortcuts = {
:h => "alert('Help!');",
:f => {
:o => {
:o => "alert('"foo" has been typed!');"
}
}
}
%>
<%
@page_shortcuts = {
:b => {
:a => {
:R => "alert('"bar" has been typed!');",
:z => "alert('"baz" has been typed!');"
}
}
}
%>
module ApplicationHelper
include AcunoteShortcutsHelper
end
<script type="text/javascript">
<%= render_shortcuts %>
</script>
Then h and foo will be available for all the pages and one page will have additional bar and baz shortcuts
This Firefox Extension and Greasemonkey Script add Gmail-style cursor, navigation and post management shortcuts to YCombinator News, Reddit and Digg. It includes aconote-shortcuts.js library, and site-specific code to setup shortcuts for each of these.
| Cursor Movement | Notes | |
|---|---|---|
| j | move cursor up | |
| k | move cursor down | |
| Post management | ||
| o, <Enter> | open original post | |
| <Shift>+o | open comments | |
| u | back to news list | |
| Voting | ||
| v then u | vote up | "dig" on Digg |
| v then d | vote down | "bury" on Digg |
| Other | ||
| g then i | open "index" page | News.YC |
| g then n | open "newest" page | News.YC, Reddit |
| g then h | open "hot" page | |
| g then b | open "browse" page | |
| g then s | open "saved" page | |
| g then r | open "recommended" page | |
| g then t | open "stats" page | |
| ? | show help | |
Ready to use. Just install it
To use Greasemonkey script with Firefox 2+ install Greasemonkey extension and load Acunote shortcuts userscript. For Safari 3+ install GreaseKit plugin and load Acunote shortcuts userscript.
To add support for a new site:
Acunote, our project management software, is the best way to see Acunote Shortcuts library in action. Just about everything is accessible through keyboard. Acunote also includes more keyboard features, which will be extracted into the library in the future - advanced list selector (like keyboard feed selector in Google Reader or QuickSilver), Esc listeners, accesskey-based shortcuts, etc.
Acunote Shortcuts framework and Greasemonkey script are released under MIT license. Your contributions are welcome.