Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Play/Pause on spacebar hit

  • Loading branch information...
commit 6e5e1d06c6a0439b481f8d205fa4bffe72c3b376 1 parent 49fe001
@secretrobotron secretrobotron authored
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();
Please sign in to comment.
Something went wrong with that request. Please try again.