diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/captions.js | 5 | ||||
-rw-r--r-- | src/js/controls.js | 33 | ||||
-rw-r--r-- | src/js/defaults.js | 43 | ||||
-rw-r--r-- | src/js/fullscreen.js | 8 | ||||
-rw-r--r-- | src/js/listeners.js | 34 | ||||
-rw-r--r-- | src/js/plyr.js | 14 | ||||
-rw-r--r-- | src/js/ui.js | 5 |
7 files changed, 125 insertions, 17 deletions
diff --git a/src/js/captions.js b/src/js/captions.js index 037de128..847ef7ff 100644 --- a/src/js/captions.js +++ b/src/js/captions.js @@ -109,7 +109,10 @@ const captions = { } // Only get accepted kinds - return Array.from(this.media.textTracks || []).filter(track => ['captions', 'subtitles'].includes(track.kind)); + return Array.from(this.media.textTracks || []).filter(track => [ + 'captions', + 'subtitles', + ].includes(track.kind)); }, // Get the current track for the current language diff --git a/src/js/controls.js b/src/js/controls.js index 1bbe10d3..8138367e 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -46,7 +46,10 @@ const controls = { } // Insert new one - styleSheet.insertRule([selector, styles].join(' ')); + styleSheet.insertRule([ + selector, + styles, + ].join(' ')); }, // Get icon URL @@ -417,7 +420,10 @@ const controls = { // Show/hide the tooltip // If the event is a moues in/out and percentage is inside bounds - if (utils.is.event(event) && ['mouseenter', 'mouseleave'].includes(event.type)) { + if (utils.is.event(event) && [ + 'mouseenter', + 'mouseleave', + ].includes(event.type)) { utils.toggleClass(this.elements.display.seekTooltip, visible, event.type === 'mouseenter'); } }, @@ -701,7 +707,15 @@ const controls = { // Set the default speeds if (!utils.is.object(this.options.speed) || !Object.keys(this.options.speed).length) { - this.options.speed = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]; + this.options.speed = [ + 0.5, + 0.75, + 1, + 1.25, + 1.5, + 1.75, + 2, + ]; } // Set options if passed and filter based on config @@ -841,7 +855,10 @@ const controls = { // Restore auto height/width const restore = e => { // We're only bothered about height and width on the container - if (e.target !== container || !['width', 'height'].includes(e.propertyName)) { + if (e.target !== container || ![ + 'width', + 'height', + ].includes(e.propertyName)) { return; } @@ -1211,7 +1228,13 @@ const controls = { if (this.config.tooltips.controls) { const labels = utils.getElements.call( this, - [this.config.selectors.controls.wrapper, ' ', this.config.selectors.labels, ' .', this.config.classNames.hidden].join('') + [ + this.config.selectors.controls.wrapper, + ' ', + this.config.selectors.labels, + ' .', + this.config.classNames.hidden, + ].join('') ); Array.from(labels).forEach(label => { diff --git a/src/js/defaults.js b/src/js/defaults.js index 75b31a6d..c6271a2a 100644 --- a/src/js/defaults.js +++ b/src/js/defaults.js @@ -61,7 +61,17 @@ const defaults = { // Quality default quality: { default: 'default', - options: ['hd2160', 'hd1440', 'hd1080', 'hd720', 'large', 'medium', 'small', 'tiny', 'default'], + options: [ + 'hd2160', + 'hd1440', + 'hd1080', + 'hd720', + 'large', + 'medium', + 'small', + 'tiny', + 'default', + ], }, // Set loops @@ -74,7 +84,15 @@ const defaults = { // Speed default and options to display speed: { selected: 1, - options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2], + options: [ + 0.5, + 0.75, + 1, + 1.25, + 1.5, + 1.75, + 2, + ], }, // Keyboard shortcut settings @@ -108,8 +126,25 @@ const defaults = { }, // Default controls - controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen'], - settings: ['captions', 'quality', 'speed', 'loop'], + controls: [ + 'play-large', + 'play', + 'progress', + 'current-time', + 'mute', + 'volume', + 'captions', + 'settings', + 'pip', + 'airplay', + 'fullscreen', + ], + settings: [ + 'captions', + 'quality', + 'speed', + 'loop', + ], // Localisation i18n: { diff --git a/src/js/fullscreen.js b/src/js/fullscreen.js index ac7d5fac..366ea729 100644 --- a/src/js/fullscreen.js +++ b/src/js/fullscreen.js @@ -12,7 +12,13 @@ const prefix = (() => { value = ''; } else { // Check for fullscreen support by vendor prefix - ['webkit', 'o', 'moz', 'ms', 'khtml'].some(pre => { + [ + 'webkit', + 'o', + 'moz', + 'ms', + 'khtml', + ].some(pre => { if (utils.is.function(document[`${pre}CancelFullScreen`])) { value = pre; return true; diff --git a/src/js/listeners.js b/src/js/listeners.js index 32557e72..0d57f5e1 100644 --- a/src/js/listeners.js +++ b/src/js/listeners.js @@ -46,7 +46,29 @@ const listeners = { // Reset on keyup if (pressed) { // Which keycodes should we prevent default - const preventDefault = [48, 49, 50, 51, 52, 53, 54, 56, 57, 32, 75, 38, 40, 77, 39, 37, 70, 67, 73, 76, 79]; + const preventDefault = [ + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 56, + 57, + 32, + 75, + 38, + 40, + 77, + 39, + 37, + 70, + 67, + 73, + 76, + 79, + ]; // Check focused element // and if the focused element is not editable (e.g. text input) @@ -325,7 +347,10 @@ const listeners = { // Proxy events to container // Bubble up key events for Edge - utils.on(this.media, this.config.events.concat(['keyup', 'keydown']).join(' '), event => { + utils.on(this.media, this.config.events.concat([ + 'keyup', + 'keydown', + ]).join(' '), event => { let detail = {}; // Get error details from media @@ -499,7 +524,10 @@ const listeners = { // Watch for cursor over controls so they don't hide when trying to interact utils.on(this.elements.controls, 'mousedown mouseup touchstart touchend touchcancel', event => { - this.elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type); + this.elements.controls.pressed = [ + 'mousedown', + 'touchstart', + ].includes(event.type); }); // Focus in/out on controls diff --git a/src/js/plyr.js b/src/js/plyr.js index a482f41f..9b06ed65 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -939,10 +939,20 @@ class Plyr { isEnterFullscreen = toggle.type === 'enterfullscreen'; // Whether to show controls - show = ['mouseenter', 'mousemove', 'touchstart', 'touchmove', 'focusin'].includes(toggle.type); + show = [ + 'mouseenter', + 'mousemove', + 'touchstart', + 'touchmove', + 'focusin', + ].includes(toggle.type); // Delay hiding on move events - if (['mousemove', 'touchmove', 'touchend'].includes(toggle.type)) { + if ([ + 'mousemove', + 'touchmove', + 'touchend', + ].includes(toggle.type)) { delay = 2000; } diff --git a/src/js/ui.js b/src/js/ui.js index 80ec587e..44f1a367 100644 --- a/src/js/ui.js +++ b/src/js/ui.js @@ -153,7 +153,10 @@ const ui = { // Check if media is loading checkLoading(event) { - this.loading = ['stalled', 'waiting'].includes(event.type); + this.loading = [ + 'stalled', + 'waiting', + ].includes(event.type); // Clear timer clearTimeout(this.timers.loading); |