11var eventQueue = [ ] ;
2+ var startConsuming = false ;
23var svg ;
34var element ;
45var drawingArea ;
56var width ;
67var height ;
7- var volume = 0.6 ;
8+ var volume = 0.5 ;
89var ULTIMATE_DREAM_KILLER = false ; // https://github.com/debugger22/github-audio/pull/19
910var orgRepoFilterNames = [ ] ;
1011
@@ -139,9 +140,7 @@ $(function(){
139140 loaded_sounds += 1 ;
140141 if ( loaded_sounds == total_sounds ) {
141142 all_loaded = true ;
142- setTimeout ( playFromQueueExchange1 , Math . floor ( Math . random ( ) * 1000 ) ) ;
143- // Starting the second exchange makes music a bad experience
144- // setTimeout(playFromQueueExchange2, Math.floor(Math.random() * 2000));
143+ setTimeout ( playFromQueue , Math . floor ( Math . random ( ) * 1000 ) ) ;
145144 }
146145 }
147146
@@ -230,7 +229,11 @@ function playSound(size, type) {
230229// Following are the n numbers of event consumers
231230// consuming n events each per second with a random delay between them
232231
233- function playFromQueueExchange1 ( ) {
232+ function playFromQueue ( ) {
233+ if ( ! startConsuming ) {
234+ setTimeout ( playFromQueue , Math . floor ( Math . random ( ) * 1000 ) + 500 ) ;
235+ return ;
236+ }
234237 var event = eventQueue . shift ( ) ;
235238 if ( event != null && event . actor . display_login != null && ! shouldEventBeIgnored ( event ) && svg != null ) {
236239 playSound ( event . actor . display_login . length * 1.1 , event . type ) ;
@@ -239,20 +242,7 @@ function playFromQueueExchange1(){
239242 } else {
240243 console . log ( "Ignored ex 1" ) ;
241244 }
242- setTimeout ( playFromQueueExchange1 , Math . floor ( Math . random ( ) * 1000 ) + 500 ) ;
243- $ ( '.events-remaining-value' ) . html ( eventQueue . length ) ;
244- }
245-
246- function playFromQueueExchange2 ( ) {
247- var event = eventQueue . shift ( ) ;
248- if ( event != null && event . actor . display_login != null && ! shouldEventBeIgnored ( event ) && svg != null ) {
249- playSound ( event . actor . display_login . length , event . type ) ;
250- if ( ! document . hidden )
251- drawEvent ( event , svg ) ;
252- } else {
253- console . log ( "Ignored ex 2" ) ;
254- }
255- setTimeout ( playFromQueueExchange2 , Math . floor ( Math . random ( ) * 800 ) + 500 ) ;
245+ setTimeout ( playFromQueue , Math . floor ( Math . random ( ) * 1000 ) + 500 ) ;
256246 $ ( '.events-remaining-value' ) . html ( eventQueue . length ) ;
257247}
258248
@@ -376,3 +366,17 @@ function drawEvent(data, svg_area) {
376366 $ ( '#area svg g:lt(10)' ) . remove ( ) ;
377367 }
378368}
369+
370+
371+ function playButtonHover ( e ) {
372+ e . setAttribute ( 'src' , '/public/images/play-button-hover.svg' ) ;
373+ }
374+
375+ function playButtonUnhover ( e ) {
376+ e . setAttribute ( 'src' , '/public/images/play-button.svg' ) ;
377+ }
378+
379+ function playButtonClick ( e ) {
380+ startConsuming = true ;
381+ $ ( '#clickToPlay' ) . remove ( ) ;
382+ }
0 commit comments