diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-20 11:29:26 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-20 11:29:26 +0100 |
commit | 238cd9f7f09f11ecdb1717a5d07fc33642d29043 (patch) | |
tree | 72eac94839bda4f32cb41441b2b88532eed52603 /theme/javascript/core/keyboard.js | |
parent | bac25cdf297a7fa54f21977aa17d455e439cdf51 (diff) | |
download | gitbook-238cd9f7f09f11ecdb1717a5d07fc33642d29043.zip gitbook-238cd9f7f09f11ecdb1717a5d07fc33642d29043.tar.gz gitbook-238cd9f7f09f11ecdb1717a5d07fc33642d29043.tar.bz2 |
Add back theme
Diffstat (limited to 'theme/javascript/core/keyboard.js')
-rwxr-xr-x | theme/javascript/core/keyboard.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/theme/javascript/core/keyboard.js b/theme/javascript/core/keyboard.js new file mode 100755 index 0000000..22fe953 --- /dev/null +++ b/theme/javascript/core/keyboard.js @@ -0,0 +1,38 @@ +define([ + "jQuery", + "Mousetrap", + "core/navigation", + "core/sidebar", + "core/search" +], function($, Mousetrap, navigation, sidebar, search){ + // 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; + }); + + // Toggle Search + Mousetrap.bind(['f'], function(e) { + search.toggle(); + return false; + }); + }; + + return { + init: init + }; +});
\ No newline at end of file |