diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-04 14:10:56 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-04 14:10:56 -0700 |
commit | 446d486a0fb725f3df76d9b6e8d2bca02042805b (patch) | |
tree | cfd5405f607fcca196ef5bad6b0b88662c30ccb9 /theme/javascript/core/keyboard.js | |
parent | 07101deaefb8848d40231eea12a3bf0710e6a78e (diff) | |
download | gitbook-446d486a0fb725f3df76d9b6e8d2bca02042805b.zip gitbook-446d486a0fb725f3df76d9b6e8d2bca02042805b.tar.gz gitbook-446d486a0fb725f3df76d9b6e8d2bca02042805b.tar.bz2 |
Add base for theming
Diffstat (limited to 'theme/javascript/core/keyboard.js')
-rw-r--r-- | theme/javascript/core/keyboard.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/theme/javascript/core/keyboard.js b/theme/javascript/core/keyboard.js new file mode 100644 index 0000000..05e939e --- /dev/null +++ b/theme/javascript/core/keyboard.js @@ -0,0 +1,31 @@ +define([ + "jQuery", + "Mousetrap", + "core/navigation", + "core/sidebar" +], function($, Mousetrap, navigation, sidebar){ + // Bind keyboard shortcuts + var init = function() { + // Next + Mousetrap.bind(['right'], function(e) { + navigation.goNext(); + return false; + }); + + // Prev + Mousetrap.bind(['left'], function(e) { + navigation.goPrev(); + return false; + }); + + // Toggle Summary + Mousetrap.bind(['s'], function(e) { + sidebar.toggle(); + return false; + }); + }; + + return { + init: init + }; +});
\ No newline at end of file |