From c47106315ae3c403239cda29c49b4bba51ddccb2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 2 Apr 2019 18:30:26 +0200 Subject: tslint update --- .../player/p2p-media-loader/segment-url-builder.ts | 4 ++-- client/src/assets/player/utils.ts | 4 ++-- .../videojs-components/resolution-menu-button.ts | 2 +- .../player/videojs-components/settings-menu-button.ts | 18 +++++++++--------- .../player/videojs-components/settings-menu-item.ts | 10 +++++----- .../assets/player/webtorrent/peertube-chunk-store.ts | 6 +++--- client/src/assets/player/webtorrent/video-renderer.ts | 2 +- .../src/assets/player/webtorrent/webtorrent-plugin.ts | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) (limited to 'client/src/assets') diff --git a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts b/client/src/assets/player/p2p-media-loader/segment-url-builder.ts index 32e7ce4f2..fb990a19d 100644 --- a/client/src/assets/player/p2p-media-loader/segment-url-builder.ts +++ b/client/src/assets/player/p2p-media-loader/segment-url-builder.ts @@ -8,8 +8,8 @@ function segmentUrlBuilderFactory (baseUrls: string[]) { if (i === max - 1) return segment.url - let newBaseUrl = baseUrls[i] - let middlePart = newBaseUrl.endsWith('/') ? '' : '/' + const newBaseUrl = baseUrls[i] + const middlePart = newBaseUrl.endsWith('/') ? '' : '/' return newBaseUrl + middlePart + basename(segment.url) } diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index 54f131310..0966027ac 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts @@ -61,12 +61,12 @@ function secondsToTime (seconds: number, full = false, symbol?: string) { const minuteSymbol = (symbol || 'm') const secondsSymbol = full ? '' : 's' - let hours = Math.floor(seconds / 3600) + const hours = Math.floor(seconds / 3600) if (hours >= 1) time = hours + hourSymbol else if (full) time = '0' + hourSymbol seconds %= 3600 - let minutes = Math.floor(seconds / 60) + const minutes = Math.floor(seconds / 60) if (minutes >= 1 && minutes < 10 && full) time += '0' + minutes + minuteSymbol else if (minutes >= 1) time += minutes + minuteSymbol else if (full) time += '00' + minuteSymbol diff --git a/client/src/assets/player/videojs-components/resolution-menu-button.ts b/client/src/assets/player/videojs-components/resolution-menu-button.ts index abcc16411..cff44de72 100644 --- a/client/src/assets/player/videojs-components/resolution-menu-button.ts +++ b/client/src/assets/player/videojs-components/resolution-menu-button.ts @@ -49,7 +49,7 @@ class ResolutionMenuButton extends MenuButton { private addClickListener (component: any) { component.on('click', () => { - let children = this.menu.children() + const children = this.menu.children() for (const child of children) { if (component !== child) { diff --git a/client/src/assets/player/videojs-components/settings-menu-button.ts b/client/src/assets/player/videojs-components/settings-menu-button.ts index 14cb8ba43..5e09032b4 100644 --- a/client/src/assets/player/videojs-components/settings-menu-button.ts +++ b/client/src/assets/player/videojs-components/settings-menu-button.ts @@ -53,7 +53,7 @@ class SettingsButton extends Button { onDisposeSettingsItem (event: any, name: string) { if (name === undefined) { - let children = this.menu.children() + const children = this.menu.children() while (children.length > 0) { children[0].dispose() @@ -62,7 +62,7 @@ class SettingsButton extends Button { this.addClass('vjs-hidden') } else { - let item = this.menu.getChild(name) + const item = this.menu.getChild(name) if (item) { item.dispose() @@ -148,8 +148,8 @@ class SettingsButton extends Button { return } - let offset = this.options_.setup.maxHeightOffset - let maxHeight = this.playerComponent.el_.offsetHeight - offset + const offset = this.options_.setup.maxHeightOffset + const maxHeight = this.playerComponent.el_.offsetHeight - offset if (height > maxHeight) { height = maxHeight @@ -166,7 +166,7 @@ class SettingsButton extends Button { buildMenu () { this.menu = new Menu(this.player()) this.menu.addClass('vjs-main-menu') - let entries = this.options_.entries + const entries = this.options_.entries if (entries.length === 0) { this.addClass('vjs-hidden') @@ -174,7 +174,7 @@ class SettingsButton extends Button { return } - for (let entry of entries) { + for (const entry of entries) { this.addMenuItem(entry, this.options_) } @@ -191,7 +191,7 @@ class SettingsButton extends Button { } options.name = toTitleCase(entry) - let settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any) + const settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any) this.menu.addChild(settingsMenuItem) @@ -204,7 +204,7 @@ class SettingsButton extends Button { } resetChildren () { - for (let menuChild of this.menu.children()) { + for (const menuChild of this.menu.children()) { menuChild.reset() } } @@ -213,7 +213,7 @@ class SettingsButton extends Button { * Hide all the sub menus */ hideChildren () { - for (let menuChild of this.menu.children()) { + for (const menuChild of this.menu.children()) { menuChild.hideSubMenu() } } diff --git a/client/src/assets/player/videojs-components/settings-menu-item.ts b/client/src/assets/player/videojs-components/settings-menu-item.ts index f14959f9c..78879a2ec 100644 --- a/client/src/assets/player/videojs-components/settings-menu-item.ts +++ b/client/src/assets/player/videojs-components/settings-menu-item.ts @@ -167,7 +167,7 @@ class SettingsMenuItem extends MenuItem { * @method PrefixedEvent */ PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') { - let prefix = ['webkit', 'moz', 'MS', 'o', ''] + const prefix = ['webkit', 'moz', 'MS', 'o', ''] for (let p = 0; p < prefix.length; p++) { if (!prefix[p]) { @@ -249,7 +249,7 @@ class SettingsMenuItem extends MenuItem { update (event?: any) { let target: HTMLElement = null - let subMenu = this.subMenu.name() + const subMenu = this.subMenu.name() if (event && event.type === 'tap') { target = event.target @@ -264,7 +264,7 @@ class SettingsMenuItem extends MenuItem { setTimeout(() => this.settingsSubMenuValueEl_.innerHTML = this.subMenu.labelEl_.innerHTML, 250) } else { // Loop trough the submenu items to find the selected child - for (let subMenuItem of this.subMenu.menu.children_) { + for (const subMenuItem of this.subMenu.menu.children_) { if (!(subMenuItem instanceof component)) { continue } @@ -287,7 +287,7 @@ class SettingsMenuItem extends MenuItem { } bindClickEvents () { - for (let item of this.subMenu.menu.children()) { + for (const item of this.subMenu.menu.children()) { if (!(item instanceof component)) { continue } @@ -307,7 +307,7 @@ class SettingsMenuItem extends MenuItem { } setMargin () { - let [width] = this.size + const [ width ] = this.size this.settingsSubMenuEl_.style.marginRight = `-${width}px` } diff --git a/client/src/assets/player/webtorrent/peertube-chunk-store.ts b/client/src/assets/player/webtorrent/peertube-chunk-store.ts index 54cc0ea64..66762bef8 100644 --- a/client/src/assets/player/webtorrent/peertube-chunk-store.ts +++ b/client/src/assets/player/webtorrent/peertube-chunk-store.ts @@ -131,7 +131,7 @@ export class PeertubeChunkStore extends EventEmitter { // Chunk in store this.db.transaction('r', this.db.chunks, async () => { const result = await this.db.chunks.get({ id: index }) - if (result === undefined) return cb(null, new Buffer(0)) + if (result === undefined) return cb(null, Buffer.alloc(0)) const buf = result.buf if (!opts) return this.nextTick(cb, null, buf) @@ -162,13 +162,13 @@ export class PeertubeChunkStore extends EventEmitter { } if (this.db) { - await this.db.close() + this.db.close() await this.dropDatabase(this.databaseName) } if (this.expirationDB) { - await this.expirationDB.close() + this.expirationDB.close() this.expirationDB = null } diff --git a/client/src/assets/player/webtorrent/video-renderer.ts b/client/src/assets/player/webtorrent/video-renderer.ts index a3415937b..4dce87112 100644 --- a/client/src/assets/player/webtorrent/video-renderer.ts +++ b/client/src/assets/player/webtorrent/video-renderer.ts @@ -29,7 +29,7 @@ function renderVideo ( function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) { const extension = extname(file.name).toLowerCase() - let preparedElem: any = undefined + let preparedElem: any let currentTime = 0 let renderer: any diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts index c7182acc9..eee3d4db9 100644 --- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts +++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts @@ -347,7 +347,7 @@ class WebTorrentPlugin extends Plugin { if (!averageDownloadSpeed) averageDownloadSpeed = this.getAndSaveActualDownloadSpeed() // Limit resolution according to player height - const playerHeight = this.playerElement.offsetHeight as number + const playerHeight = this.playerElement.offsetHeight // We take the first resolution just above the player height // Example: player height is 530px, we want the 720p file instead of 480p -- cgit v1.2.3