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