lib/public/js/parade-keyboard-input.js in parade-0.8.0 vs lib/public/js/parade-keyboard-input.js in parade-0.8.1

- old
+ new

@@ -2,53 +2,107 @@ // Register all the keyboard inputs for Parade presentation events. // $(document).ready(function() { - $.subscribe("console:show",function() { - KeyboardJS.disable(); - }); + KeyboardCreate('MainKeyboard'); - $.subscribe("console:hidden",function() { - KeyboardJS.enable(); + MainKeyboard.on('graveaccent',function(){ + $.publish("console:show"); }); - KeyboardJS.on('space, right, pagedown, down', function(){ + MainKeyboard.on('space, right, pagedown, down', function(){ $.publish("presentation:slide:next"); }); - KeyboardJS.on('shift + space, left, pageup, up', function(){ + MainKeyboard.on('shift + space, left, pageup, up', function(){ $.publish("presentation:slide:previous"); }); - KeyboardJS.on('h, ?', function(){ + MainKeyboard.on('h, ?', function(){ $.publish("help:toggle"); }); - KeyboardJS.on('b, f', function(){ + MainKeyboard.on('b, f', function(){ $.publish("presentation:footer:toggle"); }); - KeyboardJS.on('d', function(){ + MainKeyboard.on('t, c', function(){ + $.publish("navigation:show"); + }); + + MainKeyboard.on('d', function(){ $.publish("debug:toggle"); }); - KeyboardJS.on('n', function(){ + MainKeyboard.on('n', function(){ $.publish("presentation:speaker:notes:toggle"); }); - KeyboardJS.on('shift + p', function(){ + MainKeyboard.on('shift + p', function(){ $.publish("presentation:pause:toggle"); }); - KeyboardJS.on('p', function(){ + MainKeyboard.on('p', function(){ $.publish("presentation:preshow:toggle"); }); - KeyboardJS.on('enter', function(){ + MainKeyboard.on('enter', function(){ $.publish("code:execute:visible") }); - KeyboardJS.on('escape', function(){ + MainKeyboard.on('escape', function(){ $.publish("code:execution:clear"); }); + + + KeyboardCreate('ConsoleKeyboard'); + ConsoleKeyboard.disable(); + + ConsoleKeyboard.on('graveaccent',function() { + $.publish("console:hidden"); + }); + + $.subscribe("console:show", function() { + setTimeout(function() { ConsoleKeyboard.enable(); }, 50 ); + MainKeyboard.disable(); + }); + + $.subscribe("console:hidden", function() { + setTimeout(function() { MainKeyboard.enable(); }, 50 ); + ConsoleKeyboard.disable(); + }); + + KeyboardCreate('NavigationKeyboard'); + NavigationKeyboard.disable(); + + NavigationKeyboard.on('t, c, escape',function() { + $.publish("navigation:hidden"); + }); + + NavigationKeyboard.on('down',function() { + $.publish("navigation:down"); + }); + NavigationKeyboard.on('up',function() { + $.publish("navigation:up"); + }); + NavigationKeyboard.on('left',function() { + $.publish("navigation:left"); + }); + NavigationKeyboard.on('right',function() { + $.publish("navigation:right") + }); + NavigationKeyboard.on('enter',function() { + $.publish("navigation:selection"); + }); + + $.subscribe("navigation:show", function() { + setTimeout(function() { NavigationKeyboard.enable(); }, 50 ); + MainKeyboard.disable(); + }); + + $.subscribe("navigation:hidden", function() { + setTimeout(function() { MainKeyboard.enable(); }, 50 ); + NavigationKeyboard.disable(); + }); + }); \ No newline at end of file