|
297 | 297 | var whichButton, prefsPopup; |
298 | 298 |
|
299 | 299 | whichButton = this.getButtonNameFromClass($(el).attr('class')); |
300 | | - |
301 | | - if (whichButton === 'play') { |
302 | | - this.clickedPlay = true; |
303 | | - this.handlePlay(); |
304 | | - } else if (whichButton === 'restart') { |
305 | | - this.seekTrigger = 'restart'; |
306 | | - this.handleRestart(); |
307 | | - } else if (whichButton === 'previous') { |
308 | | - this.userClickedPlaylist = true; |
309 | | - this.okToPlay = true; |
310 | | - this.seekTrigger = 'previous'; |
311 | | - this.buttonWithFocus = 'previous'; |
312 | | - this.handlePrevTrack(); |
313 | | - } else if (whichButton === 'next') { |
314 | | - this.userClickedPlaylist = true; |
315 | | - this.okToPlay = true; |
316 | | - this.seekTrigger = 'next'; |
317 | | - this.buttonWithFocus = 'next'; |
318 | | - this.handleNextTrack(); |
319 | | - } else if (whichButton === 'rewind') { |
320 | | - this.seekTrigger = 'rewind'; |
321 | | - this.handleRewind(); |
322 | | - } else if (whichButton === 'forward') { |
323 | | - this.seekTrigger = 'forward'; |
324 | | - this.handleFastForward(); |
325 | | - } else if (whichButton === 'mute') { |
326 | | - this.handleMute(); |
327 | | - } else if (whichButton === 'volume') { |
328 | | - this.handleVolumeButtonClick(); |
329 | | - } else if (whichButton === 'faster') { |
330 | | - this.handleRateIncrease(); |
331 | | - } else if (whichButton === 'slower') { |
332 | | - this.handleRateDecrease(); |
333 | | - } else if (whichButton === 'captions') { |
334 | | - this.handleCaptionToggle(); |
335 | | - } else if (whichButton === 'chapters') { |
336 | | - this.handleChapters(); |
337 | | - } else if (whichButton === 'descriptions') { |
338 | | - this.handleDescriptionToggle(); |
339 | | - } else if (whichButton === 'sign') { |
340 | | - if (!this.closingSign) { |
341 | | - this.handleSignToggle(); |
342 | | - } |
343 | | - } else if (whichButton === 'preferences') { |
344 | | - if ($(el).attr('data-prefs-popup') === 'menu') { |
345 | | - this.handlePrefsClick(); |
346 | | - } else { |
347 | | - this.showingPrefsDialog = true; // stopgap |
348 | | - this.closePopups(); |
349 | | - prefsPopup = $(el).attr('data-prefs-popup'); |
350 | | - if (prefsPopup === 'keyboard') { |
351 | | - this.keyboardPrefsDialog.show(); |
352 | | - } else if (prefsPopup === 'captions') { |
353 | | - this.captionPrefsDialog.show(); |
354 | | - } else if (prefsPopup === 'descriptions') { |
355 | | - this.descPrefsDialog.show(); |
356 | | - } else if (prefsPopup === 'transcript') { |
357 | | - this.transcriptPrefsDialog.show(); |
358 | | - } |
359 | | - this.showingPrefsDialog = false; |
360 | | - } |
361 | | - } else if (whichButton === 'help') { |
362 | | - this.handleHelpClick(); |
363 | | - } else if (whichButton === 'transcript') { |
364 | | - if (!this.closingTranscript) { |
365 | | - this.handleTranscriptToggle(); |
366 | | - } |
367 | | - } else if (whichButton === 'fullscreen') { |
368 | | - this.clickedFullscreenButton = true; |
369 | | - this.handleFullscreenToggle(); |
| 300 | + switch ( whichButton ) { |
| 301 | + case 'play': |
| 302 | + this.clickedPlay = true; |
| 303 | + this.handlePlay(); |
| 304 | + break; |
| 305 | + case 'restart': |
| 306 | + this.seekTrigger = 'restart'; |
| 307 | + this.handleRestart(); |
| 308 | + break; |
| 309 | + case 'previous': |
| 310 | + this.userClickedPlaylist = true; |
| 311 | + this.okToPlay = true; |
| 312 | + this.seekTrigger = 'previous'; |
| 313 | + this.buttonWithFocus = 'previous'; |
| 314 | + this.handlePrevTrack(); |
| 315 | + break; |
| 316 | + case 'next': |
| 317 | + this.userClickedPlaylist = true; |
| 318 | + this.okToPlay = true; |
| 319 | + this.seekTrigger = 'next'; |
| 320 | + this.buttonWithFocus = 'next'; |
| 321 | + this.handleNextTrack(); |
| 322 | + break; |
| 323 | + case 'rewind': |
| 324 | + this.seekTrigger = 'rewind'; |
| 325 | + this.handleRewind(); |
| 326 | + break; |
| 327 | + case 'forward': |
| 328 | + this.seekTrigger = 'forward'; |
| 329 | + this.handleFastForward(); |
| 330 | + break; |
| 331 | + case 'mute': |
| 332 | + this.handleMute(); |
| 333 | + break; |
| 334 | + case 'volume': |
| 335 | + this.handleVolumeButtonClick(); |
| 336 | + break; |
| 337 | + case 'faster': |
| 338 | + this.handleRateIncrease(); |
| 339 | + break; |
| 340 | + case 'slower': |
| 341 | + this.handleRateDecrease(); |
| 342 | + break; |
| 343 | + case 'captions': |
| 344 | + this.handleCaptionToggle(); |
| 345 | + break; |
| 346 | + case 'chapters': |
| 347 | + this.handleChapters(); |
| 348 | + break; |
| 349 | + case 'descriptions': |
| 350 | + this.handleDescriptionToggle(); |
| 351 | + break; |
| 352 | + case 'sign': |
| 353 | + if ( ! this.closingSign ) { |
| 354 | + this.handleSignToggle(); |
| 355 | + } |
| 356 | + break; |
| 357 | + case 'preferences': |
| 358 | + if ($(el).attr('data-prefs-popup') === 'menu') { |
| 359 | + this.handlePrefsClick(); |
| 360 | + } else { |
| 361 | + this.showingPrefsDialog = true; // stopgap |
| 362 | + this.closePopups(); |
| 363 | + prefsPopup = $(el).attr('data-prefs-popup'); |
| 364 | + if (prefsPopup === 'keyboard') { |
| 365 | + this.keyboardPrefsDialog.show(); |
| 366 | + } else if (prefsPopup === 'captions') { |
| 367 | + this.captionPrefsDialog.show(); |
| 368 | + } else if (prefsPopup === 'descriptions') { |
| 369 | + this.descPrefsDialog.show(); |
| 370 | + } else if (prefsPopup === 'transcript') { |
| 371 | + this.transcriptPrefsDialog.show(); |
| 372 | + } |
| 373 | + this.showingPrefsDialog = false; |
| 374 | + } |
| 375 | + break; |
| 376 | + case 'help': |
| 377 | + this.handleHelpClick(); |
| 378 | + break; |
| 379 | + case 'transcript': |
| 380 | + if ( !this.closingTranscript ) { |
| 381 | + this.handleTranscriptToggle(); |
| 382 | + } |
| 383 | + break; |
| 384 | + case 'fullscreen': |
| 385 | + this.clickedFullscreenButton = true; |
| 386 | + this.handleFullscreenToggle(); |
| 387 | + break; |
370 | 388 | } |
371 | 389 | }; |
372 | 390 |
|
|
0 commit comments