Browse files

Play/Pause on spacebar hit

  • Loading branch information...
1 parent 49fe001 commit 6e5e1d06c6a0439b481f8d205fa4bffe72c3b376 @secretrobotron secretrobotron committed Mar 29, 2011
Showing with 26 additions and 0 deletions.
  1. +26 −0 js/butter.application.js
View
26 js/butter.application.js
@@ -406,6 +406,32 @@
TrackEvents,
TrackExport;
+ openDialogs = 0;
+
+
+ $doc.bind('dialogopen', function ( e ) {
+ ++openDialogs;
+ });
+
+ $doc.bind('dialogclose', function ( e ) {
+ if ( openDialogs > 0 ) {
+ --openDialogs;
+ } //if
+ });
+
+ $win.bind('keydown', function ( event ) {
+ if ( event.which === 32 && openDialogs === 0 ) {
+ if ( event.target.tagName.toLowerCase() !== 'button') {
+ if ( $popcorn.video.paused ) {
+ $popcorn.play();
+ }
+ else {
+ $popcorn.pause();
+ }
+ }
+ }
+ });
+
// Start with overlay scenes hidden
$loadready.hide();

0 comments on commit 6e5e1d0

Please sign in to comment.