chore: linting

This commit is contained in:
Sam Potts 2021-10-13 21:45:30 +11:00
parent cf8e9341f2
commit dca2ff8cfd
2 changed files with 9 additions and 12 deletions

View File

@ -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;
}

View File

@ -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=|\/)+(?<hash>[\d,a-f]+)/
const found = url.match(regex)
const regex = /^.*(?:vimeo.com\/|video\/)(?:\d+)(?:\?.*&*h=|\/)+(?<hash>[\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 <div> if needed
if (is.empty(source)) {
source = player.media.getAttribute(player.config.attributes.embed.id);
// hash can also be set as attribute on the <div>
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) {