chore: linting
This commit is contained in:
parent
b6b7db7327
commit
fa653a8859
@ -22,7 +22,7 @@ import toggleClass from './toggle-class';
|
|||||||
if (window.location.host === production) {
|
if (window.location.host === production) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: 'https://d4ad9866ad834437a4754e23937071e4@sentry.io/305555',
|
dsn: 'https://d4ad9866ad834437a4754e23937071e4@sentry.io/305555',
|
||||||
whitelistUrls: [production].map(d => new RegExp(`https://(([a-z0-9])+(.))*${d}`)),
|
whitelistUrls: [production].map((d) => new RegExp(`https://(([a-z0-9])+(.))*${d}`)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,13 +79,13 @@ import toggleClass from './toggle-class';
|
|||||||
|
|
||||||
function render(type) {
|
function render(type) {
|
||||||
// Remove active classes
|
// Remove active classes
|
||||||
Array.from(buttons).forEach(button => toggleClass(button.parentElement, 'active', false));
|
Array.from(buttons).forEach((button) => toggleClass(button.parentElement, 'active', false));
|
||||||
|
|
||||||
// Set active on parent
|
// Set active on parent
|
||||||
toggleClass(document.querySelector(`[data-source="${type}"]`), 'active', true);
|
toggleClass(document.querySelector(`[data-source="${type}"]`), 'active', true);
|
||||||
|
|
||||||
// Show cite
|
// Show cite
|
||||||
Array.from(document.querySelectorAll('.plyr__cite')).forEach(cite => {
|
Array.from(document.querySelectorAll('.plyr__cite')).forEach((cite) => {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
cite.hidden = true;
|
cite.hidden = true;
|
||||||
});
|
});
|
||||||
@ -110,7 +110,7 @@ import toggleClass from './toggle-class';
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bind to each button
|
// Bind to each button
|
||||||
Array.from(buttons).forEach(button => {
|
Array.from(buttons).forEach((button) => {
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', () => {
|
||||||
const type = button.getAttribute('data-source');
|
const type = button.getAttribute('data-source');
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ import toggleClass from './toggle-class';
|
|||||||
});
|
});
|
||||||
|
|
||||||
// List for backwards/forwards
|
// List for backwards/forwards
|
||||||
window.addEventListener('popstate', event => {
|
window.addEventListener('popstate', (event) => {
|
||||||
if (event.state && Object.keys(event.state).includes('type')) {
|
if (event.state && Object.keys(event.state).includes('type')) {
|
||||||
setSource(event.state.type);
|
setSource(event.state.type);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ const container = document.getElementById('container');
|
|||||||
const tabClassName = 'tab-focus';
|
const tabClassName = 'tab-focus';
|
||||||
|
|
||||||
// Remove class on blur
|
// Remove class on blur
|
||||||
document.addEventListener('focusout', event => {
|
document.addEventListener('focusout', (event) => {
|
||||||
if (!event.target.classList || container.contains(event.target)) {
|
if (!event.target.classList || container.contains(event.target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -12,7 +12,7 @@ document.addEventListener('focusout', event => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add classname to tabbed elements
|
// Add classname to tabbed elements
|
||||||
document.addEventListener('keydown', event => {
|
document.addEventListener('keydown', (event) => {
|
||||||
if (event.keyCode !== 9) {
|
if (event.keyCode !== 9) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
87
src/js/plyr.d.ts
vendored
87
src/js/plyr.d.ts
vendored
@ -214,26 +214,17 @@ declare class Plyr {
|
|||||||
/**
|
/**
|
||||||
* Add an event listener for the specified event.
|
* Add an event listener for the specified event.
|
||||||
*/
|
*/
|
||||||
on<K extends keyof Plyr.PlyrEventMap>(
|
on<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
|
||||||
event: K,
|
|
||||||
callback: (this: this, event: Plyr.PlyrEventMap[K]) => void,
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an event listener for the specified event once.
|
* Add an event listener for the specified event once.
|
||||||
*/
|
*/
|
||||||
once<K extends keyof Plyr.PlyrEventMap>(
|
once<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
|
||||||
event: K,
|
|
||||||
callback: (this: this, event: Plyr.PlyrEventMap[K]) => void,
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an event listener for the specified event.
|
* Remove an event listener for the specified event.
|
||||||
*/
|
*/
|
||||||
off<K extends keyof Plyr.PlyrEventMap>(
|
off<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
|
||||||
event: K,
|
|
||||||
callback: (this: this, event: Plyr.PlyrEventMap[K]) => void,
|
|
||||||
): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check support for a mime type.
|
* Check support for a mime type.
|
||||||
@ -250,45 +241,45 @@ declare namespace Plyr {
|
|||||||
type MediaType = 'audio' | 'video';
|
type MediaType = 'audio' | 'video';
|
||||||
type Provider = 'html5' | 'youtube' | 'vimeo';
|
type Provider = 'html5' | 'youtube' | 'vimeo';
|
||||||
type StandardEventMap = {
|
type StandardEventMap = {
|
||||||
'progress': PlyrEvent,
|
progress: PlyrEvent;
|
||||||
'playing': PlyrEvent,
|
playing: PlyrEvent;
|
||||||
'play': PlyrEvent,
|
play: PlyrEvent;
|
||||||
'pause': PlyrEvent,
|
pause: PlyrEvent;
|
||||||
'timeupdate': PlyrEvent,
|
timeupdate: PlyrEvent;
|
||||||
'volumechange': PlyrEvent,
|
volumechange: PlyrEvent;
|
||||||
'seeking': PlyrEvent,
|
seeking: PlyrEvent;
|
||||||
'seeked': PlyrEvent,
|
seeked: PlyrEvent;
|
||||||
'ratechange': PlyrEvent,
|
ratechange: PlyrEvent;
|
||||||
'ended': PlyrEvent,
|
ended: PlyrEvent;
|
||||||
'enterfullscreen': PlyrEvent,
|
enterfullscreen: PlyrEvent;
|
||||||
'exitfullscreen': PlyrEvent,
|
exitfullscreen: PlyrEvent;
|
||||||
'captionsenabled': PlyrEvent,
|
captionsenabled: PlyrEvent;
|
||||||
'captionsdisabled': PlyrEvent,
|
captionsdisabled: PlyrEvent;
|
||||||
'languagechange': PlyrEvent,
|
languagechange: PlyrEvent;
|
||||||
'controlshidden': PlyrEvent,
|
controlshidden: PlyrEvent;
|
||||||
'controlsshown': PlyrEvent,
|
controlsshown: PlyrEvent;
|
||||||
'ready': PlyrEvent
|
ready: PlyrEvent;
|
||||||
};
|
};
|
||||||
// For retrocompatibility, we keep StandadEvent
|
// For retrocompatibility, we keep StandadEvent
|
||||||
type StandadEvent = keyof Plyr.StandardEventMap;
|
type StandadEvent = keyof Plyr.StandardEventMap;
|
||||||
type Html5EventMap = {
|
type Html5EventMap = {
|
||||||
'loadstart': PlyrEvent,
|
loadstart: PlyrEvent;
|
||||||
'loadeddata': PlyrEvent,
|
loadeddata: PlyrEvent;
|
||||||
'loadedmetadata': PlyrEvent,
|
loadedmetadata: PlyrEvent;
|
||||||
'canplay': PlyrEvent,
|
canplay: PlyrEvent;
|
||||||
'canplaythrough': PlyrEvent,
|
canplaythrough: PlyrEvent;
|
||||||
'stalled': PlyrEvent,
|
stalled: PlyrEvent;
|
||||||
'waiting': PlyrEvent,
|
waiting: PlyrEvent;
|
||||||
'emptied': PlyrEvent,
|
emptied: PlyrEvent;
|
||||||
'cuechange': PlyrEvent,
|
cuechange: PlyrEvent;
|
||||||
'error': PlyrEvent
|
error: PlyrEvent;
|
||||||
};
|
};
|
||||||
// For retrocompatibility, we keep Html5Event
|
// For retrocompatibility, we keep Html5Event
|
||||||
type Html5Event = keyof Plyr.Html5EventMap;
|
type Html5Event = keyof Plyr.Html5EventMap;
|
||||||
type YoutubeEventMap = {
|
type YoutubeEventMap = {
|
||||||
'statechange': PlyrStateChangeEvent,
|
statechange: PlyrStateChangeEvent;
|
||||||
'qualitychange': PlyrEvent,
|
qualitychange: PlyrEvent;
|
||||||
'qualityrequested': PlyrEvent
|
qualityrequested: PlyrEvent;
|
||||||
};
|
};
|
||||||
// For retrocompatibility, we keep YoutubeEvent
|
// For retrocompatibility, we keep YoutubeEvent
|
||||||
type YoutubeEvent = keyof Plyr.YoutubeEventMap;
|
type YoutubeEvent = keyof Plyr.YoutubeEventMap;
|
||||||
@ -643,14 +634,14 @@ declare namespace Plyr {
|
|||||||
PLAYING = 1,
|
PLAYING = 1,
|
||||||
PAUSED = 2,
|
PAUSED = 2,
|
||||||
BUFFERING = 3,
|
BUFFERING = 3,
|
||||||
CUED = 5
|
CUED = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PlyrStateChangeEvent extends CustomEvent {
|
interface PlyrStateChangeEvent extends CustomEvent {
|
||||||
readonly detail: {
|
readonly detail: {
|
||||||
readonly plyr: Plyr,
|
readonly plyr: Plyr;
|
||||||
readonly code: YoutubeState
|
readonly code: YoutubeState;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Support {
|
interface Support {
|
||||||
|
@ -75,8 +75,8 @@ const tasks = {
|
|||||||
const sizeOptions = { showFiles: true, gzip: true };
|
const sizeOptions = { showFiles: true, gzip: true };
|
||||||
|
|
||||||
// Clean out /dist
|
// Clean out /dist
|
||||||
gulp.task('clean', done => {
|
gulp.task('clean', (done) => {
|
||||||
const dirs = [paths.plyr.output, paths.demo.output].map(dir => path.join(dir, '**/*'));
|
const dirs = [paths.plyr.output, paths.demo.output].map((dir) => path.join(dir, '**/*'));
|
||||||
|
|
||||||
// Don't delete the mp4
|
// Don't delete the mp4
|
||||||
dirs.push(`!${path.join(paths.plyr.output, '**/*.mp4')}`);
|
dirs.push(`!${path.join(paths.plyr.output, '**/*.mp4')}`);
|
||||||
@ -90,7 +90,7 @@ gulp.task('clean', done => {
|
|||||||
Object.entries(build.js).forEach(([filename, entry]) => {
|
Object.entries(build.js).forEach(([filename, entry]) => {
|
||||||
const { dist, formats, namespace, polyfill, src } = entry;
|
const { dist, formats, namespace, polyfill, src } = entry;
|
||||||
|
|
||||||
formats.forEach(format => {
|
formats.forEach((format) => {
|
||||||
const name = `js:${filename}:${format}`;
|
const name = `js:${filename}:${format}`;
|
||||||
const extension = format === 'es' ? 'mjs' : 'js';
|
const extension = format === 'es' ? 'mjs' : 'js';
|
||||||
tasks.js.push(name);
|
tasks.js.push(name);
|
||||||
|
@ -27,7 +27,7 @@ const { version } = pkg;
|
|||||||
const minSuffix = '.min';
|
const minSuffix = '.min';
|
||||||
|
|
||||||
// Get AWS config
|
// Get AWS config
|
||||||
Object.values(deploy).forEach(target => {
|
Object.values(deploy).forEach((target) => {
|
||||||
Object.assign(target, {
|
Object.assign(target, {
|
||||||
publisher: publish.create({
|
publisher: publish.create({
|
||||||
region: target.region,
|
region: target.region,
|
||||||
@ -102,7 +102,7 @@ const localPath = new RegExp('(../)?dist/', 'gi');
|
|||||||
const versionPath = `https://${deploy.cdn.domain}/${version}/`;
|
const versionPath = `https://${deploy.cdn.domain}/${version}/`;
|
||||||
const cdnpath = new RegExp(`${deploy.cdn.domain}/${regex}/`, 'gi');
|
const cdnpath = new RegExp(`${deploy.cdn.domain}/${regex}/`, 'gi');
|
||||||
|
|
||||||
const renameFile = rename(p => {
|
const renameFile = rename((p) => {
|
||||||
p.basename = p.basename.replace(minSuffix, ''); // eslint-disable-line
|
p.basename = p.basename.replace(minSuffix, ''); // eslint-disable-line
|
||||||
p.dirname = p.dirname.replace('.', version); // eslint-disable-line
|
p.dirname = p.dirname.replace('.', version); // eslint-disable-line
|
||||||
});
|
});
|
||||||
@ -120,7 +120,7 @@ const canDeploy = () => {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('version', done => {
|
gulp.task('version', (done) => {
|
||||||
if (!canDeploy()) {
|
if (!canDeploy()) {
|
||||||
done();
|
done();
|
||||||
return null;
|
return null;
|
||||||
@ -135,7 +135,7 @@ gulp.task('version', done => {
|
|||||||
|
|
||||||
return gulp
|
return gulp
|
||||||
.src(
|
.src(
|
||||||
files.map(file => path.join(root, `src/js/${file}`)),
|
files.map((file) => path.join(root, `src/js/${file}`)),
|
||||||
{ base: '.' },
|
{ base: '.' },
|
||||||
)
|
)
|
||||||
.pipe(replace(semver, `v${version}`))
|
.pipe(replace(semver, `v${version}`))
|
||||||
@ -144,7 +144,7 @@ gulp.task('version', done => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Publish version to CDN bucket
|
// Publish version to CDN bucket
|
||||||
gulp.task('cdn', done => {
|
gulp.task('cdn', (done) => {
|
||||||
if (!canDeploy()) {
|
if (!canDeploy()) {
|
||||||
done();
|
done();
|
||||||
return null;
|
return null;
|
||||||
@ -198,7 +198,7 @@ gulp.task('purge', () => {
|
|||||||
.on('end', () => {
|
.on('end', () => {
|
||||||
const purge = new FastlyPurge(fastly.token);
|
const purge = new FastlyPurge(fastly.token);
|
||||||
|
|
||||||
list.forEach(url => {
|
list.forEach((url) => {
|
||||||
log(`Purging ${ansi.cyan(url)}...`);
|
log(`Purging ${ansi.cyan(url)}...`);
|
||||||
|
|
||||||
purge.url(url, (error, result) => {
|
purge.url(url, (error, result) => {
|
||||||
@ -213,7 +213,7 @@ gulp.task('purge', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Publish to demo bucket
|
// Publish to demo bucket
|
||||||
gulp.task('demo', done => {
|
gulp.task('demo', (done) => {
|
||||||
if (!canDeploy()) {
|
if (!canDeploy()) {
|
||||||
done();
|
done();
|
||||||
return null;
|
return null;
|
||||||
@ -248,7 +248,7 @@ gulp.task('demo', done => {
|
|||||||
.src(pages)
|
.src(pages)
|
||||||
.pipe(replace(localPath, versionPath))
|
.pipe(replace(localPath, versionPath))
|
||||||
.pipe(
|
.pipe(
|
||||||
rename(p => {
|
rename((p) => {
|
||||||
if (options.demo.uploadPath) {
|
if (options.demo.uploadPath) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
p.dirname += options.demo.uploadPath;
|
p.dirname += options.demo.uploadPath;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user