summaryrefslogtreecommitdiffstats
path: root/theme/javascript/core/keyboard.js
diff options
context:
space:
mode:
Diffstat (limited to 'theme/javascript/core/keyboard.js')
-rw-r--r--theme/javascript/core/keyboard.js31
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