From dca2ff8cfd60af5ac0187e435e645e6e6d24250e Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Wed, 13 Oct 2021 21:45:30 +1100 Subject: [PATCH] chore: linting --- src/js/fullscreen.js | 4 +++- src/js/plugins/vimeo.js | 17 ++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/js/fullscreen.js b/src/js/fullscreen.js index f703fcd3..c1feadb5 100644 --- a/src/js/fullscreen.js +++ b/src/js/fullscreen.js @@ -124,7 +124,9 @@ class Fullscreen { return hasClass(this.target, this.player.config.classNames.fullscreen.fallback); } - const element = !this.prefix ? this.target.getRootNode().fullscreenElement : this.target.getRootNode()[`${this.prefix}${this.property}Element`]; + const element = !this.prefix + ? this.target.getRootNode().fullscreenElement + : this.target.getRootNode()[`${this.prefix}${this.property}Element`]; return element && element.shadowRoot ? element === this.target.getRootNode().host : element === this.target; } diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js index 28aa34f3..f20159f9 100644 --- a/src/js/plugins/vimeo.js +++ b/src/js/plugins/vimeo.js @@ -37,14 +37,10 @@ function parseHash(url) { * - video/{id}/{hash} * If matched, the hash is available in the named group `hash` */ - const regex = /^.*(?:vimeo.com\/|video\/)(?:\d+)(?:\?.*\&*h=|\/)+(?[\d,a-f]+)/ - const found = url.match(regex) + const regex = /^.*(?:vimeo.com\/|video\/)(?:\d+)(?:\?.*&*h=|\/)+(?[\d,a-f]+)/; + const found = url.match(regex); - if (found) { - return found.groups.hash - } - - return null + return found ? found.groups.hash : null; } // Set playback state and trigger change (only on actual change) @@ -90,19 +86,18 @@ const vimeo = { const player = this; const config = player.config.vimeo; const { premium, referrerPolicy, ...frameParams } = config; - // Get the source URL or ID let source = player.media.getAttribute('src'); - let hash = '' + let hash = ''; // Get from
if needed if (is.empty(source)) { source = player.media.getAttribute(player.config.attributes.embed.id); // hash can also be set as attribute on the
hash = player.media.getAttribute(player.config.attributes.embed.hash); } else { - hash = parseHash(source) + hash = parseHash(source); } - const hashParam = (!!hash) ? {h: hash} : {} + const hashParam = hash ? { h: hash } : {}; // If the owner has a pro or premium account then we can hide controls etc if (premium) {