diff options
Diffstat (limited to 'src/js/ui.js')
-rw-r--r-- | src/js/ui.js | 82 |
1 files changed, 14 insertions, 68 deletions
diff --git a/src/js/ui.js b/src/js/ui.js index 8c61d805..34fe7e82 100644 --- a/src/js/ui.js +++ b/src/js/ui.js @@ -14,16 +14,8 @@ import loadImage from './utils/loadImage'; const ui = { addStyleHook() { - toggleClass( - this.elements.container, - this.config.selectors.container.replace('.', ''), - true, - ); - toggleClass( - this.elements.container, - this.config.classNames.uiSupported, - this.supported.ui, - ); + toggleClass(this.elements.container, this.config.selectors.container.replace('.', ''), true); + toggleClass(this.elements.container, this.config.classNames.uiSupported, this.supported.ui); }, // Toggle native HTML5 media controls @@ -43,9 +35,7 @@ const ui = { // Don't setup interface if no support if (!this.supported.ui) { - this.debug.warn( - `Basic support only for ${this.provider} ${this.type}`, - ); + this.debug.warn(`Basic support only for ${this.provider} ${this.type}`); // Restore native controls ui.toggleNativeControls.call(this, true); @@ -103,25 +93,13 @@ const ui = { ); // Check for airplay support - toggleClass( - this.elements.container, - this.config.classNames.airplay.supported, - support.airplay && this.isHTML5, - ); + toggleClass(this.elements.container, this.config.classNames.airplay.supported, support.airplay && this.isHTML5); // Add iOS class - toggleClass( - this.elements.container, - this.config.classNames.isIos, - browser.isIos, - ); + toggleClass(this.elements.container, this.config.classNames.isIos, browser.isIos); // Add touch class - toggleClass( - this.elements.container, - this.config.classNames.isTouch, - this.touch, - ); + toggleClass(this.elements.container, this.config.classNames.isTouch, this.touch); // Ready for API calls this.ready = true; @@ -171,9 +149,7 @@ const ui = { } // Default to media type - const title = !is.empty(this.config.title) - ? this.config.title - : 'video'; + const title = !is.empty(this.config.title) ? this.config.title : 'video'; const format = i18n.get('frameTitle', this.config); iframe.setAttribute('title', format.replace('{title}', title)); @@ -182,11 +158,7 @@ const ui = { // Toggle poster togglePoster(enable) { - toggleClass( - this.elements.container, - this.config.classNames.posterEnabled, - enable, - ); + toggleClass(this.elements.container, this.config.classNames.posterEnabled, enable); }, // Set the poster image (async) @@ -217,9 +189,7 @@ const ui = { .then(() => { // Prevent race conditions if (poster !== this.poster) { - throw new Error( - 'setPoster cancelled by later call to setPoster', - ); + throw new Error('setPoster cancelled by later call to setPoster'); } }) .then(() => { @@ -237,21 +207,9 @@ const ui = { // Check playing state checkPlaying(event) { // Class hooks - toggleClass( - this.elements.container, - this.config.classNames.playing, - this.playing, - ); - toggleClass( - this.elements.container, - this.config.classNames.paused, - this.paused, - ); - toggleClass( - this.elements.container, - this.config.classNames.stopped, - this.stopped, - ); + toggleClass(this.elements.container, this.config.classNames.playing, this.playing); + toggleClass(this.elements.container, this.config.classNames.paused, this.paused); + toggleClass(this.elements.container, this.config.classNames.stopped, this.stopped); // Set state Array.from(this.elements.buttons.play || []).forEach(target => { @@ -277,11 +235,7 @@ const ui = { // Timer to prevent flicker when seeking this.timers.loading = setTimeout(() => { // Update progress bar loading class state - toggleClass( - this.elements.container, - this.config.classNames.loading, - this.loading, - ); + toggleClass(this.elements.container, this.config.classNames.loading, this.loading); // Update controls visibility ui.toggleControls.call(this); @@ -294,15 +248,7 @@ const ui = { if (controls && this.config.hideControls) { // Show controls if force, loading, paused, or button interaction, otherwise hide - this.toggleControls( - Boolean( - force || - this.loading || - this.paused || - controls.pressed || - controls.hover, - ), - ); + this.toggleControls(Boolean(force || this.loading || this.paused || controls.pressed || controls.hover)); } }, }; |