|
1966 | 1966 | return;
|
1967 | 1967 | }
|
1968 | 1968 |
|
1969 |
| - this.captionsButton.addEventListener( |
1970 |
| - 'click', |
1971 |
| - function() |
1972 |
| - { |
1973 |
| - this.captionsMuted = !this.captionsMuted; |
1974 |
| - }.bind(this) |
1975 |
| - ); |
| 1969 | + this.captionsButtonClick = function() |
| 1970 | + { |
| 1971 | + this.captionsMuted = !this.captionsMuted; |
| 1972 | + }.bind(this); |
| 1973 | + |
| 1974 | + this.captionsButton.addEventListener('click', this.captionsButtonClick); |
| 1975 | + |
1976 | 1976 | /**
|
1977 | 1977 | * Set the captions are enabled or not
|
1978 | 1978 | * @property {boolean} captionsMuted
|
|
2130 | 2130 | return;
|
2131 | 2131 | }
|
2132 | 2132 |
|
2133 |
| - this.captionsButton.off('click'); |
| 2133 | + this.captionsButton.removeEventListener('click', this.captionsButtonClick); |
2134 | 2134 | delete this.captionsButton;
|
2135 | 2135 | delete this._captionsStyles;
|
2136 | 2136 | delete this.getCaptionsStyles;
|
|
2428 | 2428 | plugin.teardown = function()
|
2429 | 2429 | {
|
2430 | 2430 | var pauseFocus = document.querySelector(this.options.pauseFocusSelector);
|
2431 |
| - if (pauseFocusSelector !== null) |
| 2431 | + if (pauseFocus !== null) |
2432 | 2432 | {
|
2433 | 2433 | pauseFocus.removeEventListener('focus');
|
2434 | 2434 | }
|
|
2474 | 2474 | return;
|
2475 | 2475 | }
|
2476 | 2476 |
|
2477 |
| - this.helpButton.addEventListener( |
2478 |
| - 'click', |
2479 |
| - function() |
| 2477 | + // store the listener so that we can use it later |
| 2478 | + this.helpButtonClick = function() |
| 2479 | + { |
| 2480 | + if (!this.paused && !this.helpButton.classList.contains('disabled')) |
2480 | 2481 | {
|
2481 |
| - if (!this.paused && !this.helpButton.classList.contains('disabled')) |
2482 |
| - { |
2483 |
| - this.client.send('playHelp'); |
2484 |
| - } |
2485 |
| - }.bind(this) |
2486 |
| - ); |
| 2482 | + this.client.send('playHelp'); |
| 2483 | + } |
| 2484 | + }.bind(this); |
| 2485 | + |
| 2486 | + this.helpButton.addEventListener('click', this.helpButtonClick); |
2487 | 2487 |
|
2488 | 2488 | this.helpButton.tooltip = function()
|
2489 | 2489 | {
|
|
2567 | 2567 | return;
|
2568 | 2568 | }
|
2569 | 2569 |
|
2570 |
| - this.helpButton.off('click'); |
| 2570 | + this.helpButton.removeEventListener('click', this.helpButtonClick); |
2571 | 2571 | delete this.helpButton;
|
2572 | 2572 | delete this._helpEnabled;
|
2573 | 2573 | };
|
|
2589 | 2589 | * Reference to the pause application button
|
2590 | 2590 | * @property {HTMLElement} pauseButton
|
2591 | 2591 | */
|
2592 |
| - this.pauseButton = document.querySelector(this.options.pauseButton); |
| 2592 | + this.pauseButton = document.querySelectorAll(this.options.pauseButton); |
2593 | 2593 |
|
2594 |
| - if (this.pauseButton === null) |
2595 |
| - { |
2596 |
| - return; |
2597 |
| - } |
| 2594 | + this.onPauseToggle = onPauseToggle.bind(this); |
2598 | 2595 |
|
2599 |
| - this.pauseButton.addEventListener('click', onPauseToggle.bind(this)); |
| 2596 | + this.pauseButton.forEach(function(element) |
| 2597 | + { |
| 2598 | + element.addEventListener('click', this.onPauseToggle); |
| 2599 | + }.bind(this)); |
2600 | 2600 |
|
2601 | 2601 | /**
|
2602 | 2602 | * If the application is currently paused manually
|
|
2656 | 2656 | this.trigger('pause', paused);
|
2657 | 2657 |
|
2658 | 2658 | // Set the pause button state
|
2659 |
| - if (this.pauseButton !== null) |
2660 |
| - { |
2661 |
| - this.pauseButton.classList.remove('unpaused'); |
2662 |
| - this.pauseButton.classList.remove('paused'); |
2663 |
| - this.pauseButton.classList.add(paused ? 'paused' : 'unpaused'); |
2664 |
| - } |
| 2659 | + this.pauseButton.forEach( |
| 2660 | + function(element) |
| 2661 | + { |
| 2662 | + element.classList.remove('unpaused'); |
| 2663 | + element.classList.remove('paused'); |
| 2664 | + |
| 2665 | + element.classList.add(paused ? 'paused' : 'unpaused'); |
| 2666 | + }.bind(this) |
| 2667 | + ); |
2665 | 2668 | }
|
2666 | 2669 | },
|
2667 | 2670 | get: function()
|
|
2692 | 2695 |
|
2693 | 2696 | plugin.opened = function()
|
2694 | 2697 | {
|
2695 |
| - if (this.pauseButton === null) |
2696 |
| - { |
2697 |
| - return; |
2698 |
| - } |
2699 |
| - |
2700 |
| - this.pauseButton.classList.remove('disabled'); |
| 2698 | + this.pauseButton.forEach( |
| 2699 | + function(element) |
| 2700 | + { |
| 2701 | + element.classList.remove('disabled'); |
| 2702 | + }.bind(this) |
| 2703 | + ); |
2701 | 2704 |
|
2702 | 2705 | // Reset the paused state
|
2703 | 2706 | this.paused = this._paused;
|
2704 | 2707 | };
|
2705 | 2708 |
|
2706 | 2709 | plugin.close = function()
|
2707 | 2710 | {
|
2708 |
| - this._disableButton(this.pauseButton); |
| 2711 | + this.pauseButton.forEach(this._disableButton.bind(this)); |
2709 | 2712 | this.paused = false;
|
2710 | 2713 | };
|
2711 | 2714 |
|
2712 | 2715 | plugin.teardown = function()
|
2713 | 2716 | {
|
2714 |
| - this.pauseButton.removeEventListener('click', onPauseToggle.bind(this)); |
| 2717 | + this.pauseButton.forEach( |
| 2718 | + function(element) |
| 2719 | + { |
| 2720 | + element.removeEventListener('click', this.onPauseToggle); |
| 2721 | + }.bind(this) |
| 2722 | + ); |
2715 | 2723 | delete this.pauseButton;
|
2716 | 2724 | delete this._isManualPause;
|
2717 | 2725 | delete this._paused;
|
|
0 commit comments