Merge pull request #1034 from friday/remove-array-newline-rule

Suggestion: Remove array newline rule
This commit is contained in:
Sam Potts
2018-06-15 15:34:29 +10:00
committed by GitHub
13 changed files with 31 additions and 138 deletions

View File

@ -49,10 +49,7 @@ const captions = {
const src = track.getAttribute('src');
const url = parseUrl(src);
if (url !== null && url.hostname !== window.location.href.hostname && [
'http:',
'https:',
].includes(url.protocol)) {
if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {
fetch(src, 'blob')
.then(blob => {
track.setAttribute('src', window.URL.createObjectURL(blob));
@ -277,10 +274,9 @@ const captions = {
const tracks = Array.from((this.media || {}).textTracks || []);
// For HTML5, use cache instead of current tracks when it exists (if captions.update is false)
// Filter out removed tracks and tracks that aren't captions/subtitles (for example metadata)
return tracks.filter(track => !this.isHTML5 || update || this.captions.meta.has(track)).filter(track => [
'captions',
'subtitles',
].includes(track.kind));
return tracks
.filter(track => !this.isHTML5 || update || this.captions.meta.has(track))
.filter(track => ['captions', 'subtitles'].includes(track.kind));
},
// Match tracks based on languages and get the first