aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-02 18:30:26 +0200
committerChocobozzz <me@florianbigard.com>2019-04-02 18:30:26 +0200
commitc47106315ae3c403239cda29c49b4bba51ddccb2 (patch)
tree526d2f3ba284dde6bc8d83699c0a78e86d7860eb /client/src
parentf421fa06ada7bb01d91142cc8211a65e2b390d7b (diff)
downloadPeerTube-c47106315ae3c403239cda29c49b4bba51ddccb2.tar.gz
PeerTube-c47106315ae3c403239cda29c49b4bba51ddccb2.tar.zst
PeerTube-c47106315ae3c403239cda29c49b4bba51ddccb2.zip
tslint update
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+accounts/accounts.component.ts1
-rw-r--r--client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.html2
-rw-r--r--client/src/app/shared/forms/form-reactive.ts2
-rw-r--r--client/src/app/shared/misc/utils.ts4
-rw-r--r--client/src/app/shared/renderer/markdown.service.ts2
-rw-r--r--client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html4
-rw-r--r--client/src/app/shared/video-playlist/video-playlist-miniature.component.html2
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.html2
-rw-r--r--client/src/assets/player/p2p-media-loader/segment-url-builder.ts4
-rw-r--r--client/src/assets/player/utils.ts4
-rw-r--r--client/src/assets/player/videojs-components/resolution-menu-button.ts2
-rw-r--r--client/src/assets/player/videojs-components/settings-menu-button.ts18
-rw-r--r--client/src/assets/player/videojs-components/settings-menu-item.ts10
-rw-r--r--client/src/assets/player/webtorrent/peertube-chunk-store.ts6
-rw-r--r--client/src/assets/player/webtorrent/video-renderer.ts2
-rw-r--r--client/src/assets/player/webtorrent/webtorrent-plugin.ts2
-rw-r--r--client/src/polyfills.ts1
-rw-r--r--client/src/standalone/player/definitions.ts4
-rw-r--r--client/src/standalone/player/events.ts4
-rw-r--r--client/src/standalone/videos/embed.ts12
-rw-r--r--client/src/standalone/videos/test-embed.ts24
21 files changed, 55 insertions, 57 deletions
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts
index e8339b78b..d9786fb5c 100644
--- a/client/src/app/+accounts/accounts.component.ts
+++ b/client/src/app/+accounts/accounts.component.ts
@@ -7,7 +7,6 @@ import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/oper
7import { Subscription } from 'rxjs' 7import { Subscription } from 'rxjs'
8import { AuthService, Notifier, RedirectService } from '@app/core' 8import { AuthService, Notifier, RedirectService } from '@app/core'
9import { User, UserRight } from '../../../../shared' 9import { User, UserRight } from '../../../../shared'
10import { I18n } from '@ngx-translate/i18n-polyfill'
11 10
12@Component({ 11@Component({
13 templateUrl: './accounts.component.html', 12 templateUrl: './accounts.component.html',
diff --git a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.html b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.html
index 0d9fba375..befc7143c 100644
--- a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.html
+++ b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.html
@@ -1,5 +1,5 @@
1<div i18n class="title-page title-page-single"> 1<div i18n class="title-page title-page-single">
2 Created {{pagination.totalItems}} playlists 2 Created {{ pagination.totalItems }} playlists
3</div> 3</div>
4 4
5<div i18n class="no-results" *ngIf="pagination.totalItems === 0">This channel does not have playlists.</div> 5<div i18n class="no-results" *ngIf="pagination.totalItems === 0">This channel does not have playlists.</div>
diff --git a/client/src/app/shared/forms/form-reactive.ts b/client/src/app/shared/forms/form-reactive.ts
index b9873af2c..0d40b6f4a 100644
--- a/client/src/app/shared/forms/form-reactive.ts
+++ b/client/src/app/shared/forms/form-reactive.ts
@@ -59,7 +59,7 @@ export abstract class FormReactive {
59 const isDirty = control.dirty || forceCheck === true 59 const isDirty = control.dirty || forceCheck === true
60 if (control && isDirty && !control.valid) { 60 if (control && isDirty && !control.valid) {
61 const messages = validationMessages[ field ] 61 const messages = validationMessages[ field ]
62 for (const key in control.errors) { 62 for (const key of Object.keys(control.errors)) {
63 formErrors[ field ] += messages[ key ] + ' ' 63 formErrors[ field ] += messages[ key ] + ' '
64 } 64 }
65 } 65 }
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index 8a1d342c9..85fc1c3a0 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -78,10 +78,10 @@ function objectToUrlEncoded (obj: any) {
78 78
79// Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34 79// Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34
80function objectToFormData (obj: any, form?: FormData, namespace?: string) { 80function objectToFormData (obj: any, form?: FormData, namespace?: string) {
81 let fd = form || new FormData() 81 const fd = form || new FormData()
82 let formKey 82 let formKey
83 83
84 for (let key of Object.keys(obj)) { 84 for (const key of Object.keys(obj)) {
85 if (namespace) formKey = `${namespace}[${key}]` 85 if (namespace) formKey = `${namespace}[${key}]`
86 else formKey = key 86 else formKey = key
87 87
diff --git a/client/src/app/shared/renderer/markdown.service.ts b/client/src/app/shared/renderer/markdown.service.ts
index 69dc60aaf..9a9066351 100644
--- a/client/src/app/shared/renderer/markdown.service.ts
+++ b/client/src/app/shared/renderer/markdown.service.ts
@@ -45,7 +45,7 @@ export class MarkdownService {
45 45
46 const markdownIt = new MarkdownItClass('zero', { linkify: true, breaks: true }) 46 const markdownIt = new MarkdownItClass('zero', { linkify: true, breaks: true })
47 47
48 for (let rule of rules) { 48 for (const rule of rules) {
49 markdownIt.enable(rule) 49 markdownIt.enable(rule)
50 } 50 }
51 51
diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html
index 4764fc0e1..ab5a78928 100644
--- a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html
+++ b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html
@@ -19,7 +19,7 @@
19 <a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/accounts', video.byAccount ]">{{ video.byAccount }}</a> 19 <a *ngIf="accountLink" tabindex="-1" class="video-info-account" [routerLink]="[ '/accounts', video.byAccount ]">{{ video.byAccount }}</a>
20 <span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ video.byAccount }}</span> 20 <span *ngIf="!accountLink" tabindex="-1" class="video-info-account">{{ video.byAccount }}</span>
21 21
22 <span tabindex="-1" class="video-info-timestamp">{{ formatTimestamp(video)}}</span> 22 <span tabindex="-1" class="video-info-timestamp">{{ formatTimestamp(video) }}</span>
23 </div> 23 </div>
24 </a> 24 </a>
25 25
@@ -66,7 +66,7 @@
66 </div> 66 </div>
67 67
68 <span class="dropdown-item" (click)="removeFromPlaylist(video)"> 68 <span class="dropdown-item" (click)="removeFromPlaylist(video)">
69 <my-global-icon iconName="delete"></my-global-icon> <ng-container i18n>Delete from {{playlist?.displayName}}</ng-container> 69 <my-global-icon iconName="delete"></my-global-icon> <ng-container i18n>Delete from {{ playlist?.displayName }}</ng-container>
70 </span> 70 </span>
71 </div> 71 </div>
72 </div> 72 </div>
diff --git a/client/src/app/shared/video-playlist/video-playlist-miniature.component.html b/client/src/app/shared/video-playlist/video-playlist-miniature.component.html
index c01c73012..faf906c59 100644
--- a/client/src/app/shared/video-playlist/video-playlist-miniature.component.html
+++ b/client/src/app/shared/video-playlist/video-playlist-miniature.component.html
@@ -6,7 +6,7 @@
6 <img alt="" [attr.aria-labelledby]="playlist.displayName" [attr.src]="playlist.thumbnailUrl" /> 6 <img alt="" [attr.aria-labelledby]="playlist.displayName" [attr.src]="playlist.thumbnailUrl" />
7 7
8 <div class="miniature-playlist-info-overlay"> 8 <div class="miniature-playlist-info-overlay">
9 <ng-container i18n>{playlist.videosLength, plural, =0 {No videos} =1 {1 video} other {{{playlist.videosLength}} videos}}</ng-container> 9 <ng-container i18n>{playlist.videosLength, plural, =0 {No videos} =1 {1 video} other {{{ playlist.videosLength }} videos}}</ng-container>
10 </div> 10 </div>
11 11
12 <div class="play-overlay"> 12 <div class="play-overlay">
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html
index 91f77cbf3..ad1d04b70 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.html
+++ b/client/src/app/videos/+video-watch/video-watch.component.html
@@ -22,7 +22,7 @@
22 <div class="playlist-by-index"> 22 <div class="playlist-by-index">
23 <div class="playlist-by">{{ playlist.ownerBy }}</div> 23 <div class="playlist-by">{{ playlist.ownerBy }}</div>
24 <div class="playlist-index"> 24 <div class="playlist-index">
25 <span>{{currentPlaylistPosition}}</span><span>{{playlistPagination.totalItems}}</span> 25 <span>{{ currentPlaylistPosition }}</span><span>{{ playlistPagination.totalItems }}</span>
26 </div> 26 </div>
27 </div> 27 </div>
28 </div> 28 </div>
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[]) {
8 8
9 if (i === max - 1) return segment.url 9 if (i === max - 1) return segment.url
10 10
11 let newBaseUrl = baseUrls[i] 11 const newBaseUrl = baseUrls[i]
12 let middlePart = newBaseUrl.endsWith('/') ? '' : '/' 12 const middlePart = newBaseUrl.endsWith('/') ? '' : '/'
13 13
14 return newBaseUrl + middlePart + basename(segment.url) 14 return newBaseUrl + middlePart + basename(segment.url)
15 } 15 }
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) {
61 const minuteSymbol = (symbol || 'm') 61 const minuteSymbol = (symbol || 'm')
62 const secondsSymbol = full ? '' : 's' 62 const secondsSymbol = full ? '' : 's'
63 63
64 let hours = Math.floor(seconds / 3600) 64 const hours = Math.floor(seconds / 3600)
65 if (hours >= 1) time = hours + hourSymbol 65 if (hours >= 1) time = hours + hourSymbol
66 else if (full) time = '0' + hourSymbol 66 else if (full) time = '0' + hourSymbol
67 67
68 seconds %= 3600 68 seconds %= 3600
69 let minutes = Math.floor(seconds / 60) 69 const minutes = Math.floor(seconds / 60)
70 if (minutes >= 1 && minutes < 10 && full) time += '0' + minutes + minuteSymbol 70 if (minutes >= 1 && minutes < 10 && full) time += '0' + minutes + minuteSymbol
71 else if (minutes >= 1) time += minutes + minuteSymbol 71 else if (minutes >= 1) time += minutes + minuteSymbol
72 else if (full) time += '00' + minuteSymbol 72 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 {
49 49
50 private addClickListener (component: any) { 50 private addClickListener (component: any) {
51 component.on('click', () => { 51 component.on('click', () => {
52 let children = this.menu.children() 52 const children = this.menu.children()
53 53
54 for (const child of children) { 54 for (const child of children) {
55 if (component !== child) { 55 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 {
53 53
54 onDisposeSettingsItem (event: any, name: string) { 54 onDisposeSettingsItem (event: any, name: string) {
55 if (name === undefined) { 55 if (name === undefined) {
56 let children = this.menu.children() 56 const children = this.menu.children()
57 57
58 while (children.length > 0) { 58 while (children.length > 0) {
59 children[0].dispose() 59 children[0].dispose()
@@ -62,7 +62,7 @@ class SettingsButton extends Button {
62 62
63 this.addClass('vjs-hidden') 63 this.addClass('vjs-hidden')
64 } else { 64 } else {
65 let item = this.menu.getChild(name) 65 const item = this.menu.getChild(name)
66 66
67 if (item) { 67 if (item) {
68 item.dispose() 68 item.dispose()
@@ -148,8 +148,8 @@ class SettingsButton extends Button {
148 return 148 return
149 } 149 }
150 150
151 let offset = this.options_.setup.maxHeightOffset 151 const offset = this.options_.setup.maxHeightOffset
152 let maxHeight = this.playerComponent.el_.offsetHeight - offset 152 const maxHeight = this.playerComponent.el_.offsetHeight - offset
153 153
154 if (height > maxHeight) { 154 if (height > maxHeight) {
155 height = maxHeight 155 height = maxHeight
@@ -166,7 +166,7 @@ class SettingsButton extends Button {
166 buildMenu () { 166 buildMenu () {
167 this.menu = new Menu(this.player()) 167 this.menu = new Menu(this.player())
168 this.menu.addClass('vjs-main-menu') 168 this.menu.addClass('vjs-main-menu')
169 let entries = this.options_.entries 169 const entries = this.options_.entries
170 170
171 if (entries.length === 0) { 171 if (entries.length === 0) {
172 this.addClass('vjs-hidden') 172 this.addClass('vjs-hidden')
@@ -174,7 +174,7 @@ class SettingsButton extends Button {
174 return 174 return
175 } 175 }
176 176
177 for (let entry of entries) { 177 for (const entry of entries) {
178 this.addMenuItem(entry, this.options_) 178 this.addMenuItem(entry, this.options_)
179 } 179 }
180 180
@@ -191,7 +191,7 @@ class SettingsButton extends Button {
191 } 191 }
192 192
193 options.name = toTitleCase(entry) 193 options.name = toTitleCase(entry)
194 let settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any) 194 const settingsMenuItem = new SettingsMenuItem(this.player(), options, entry, this as any)
195 195
196 this.menu.addChild(settingsMenuItem) 196 this.menu.addChild(settingsMenuItem)
197 197
@@ -204,7 +204,7 @@ class SettingsButton extends Button {
204 } 204 }
205 205
206 resetChildren () { 206 resetChildren () {
207 for (let menuChild of this.menu.children()) { 207 for (const menuChild of this.menu.children()) {
208 menuChild.reset() 208 menuChild.reset()
209 } 209 }
210 } 210 }
@@ -213,7 +213,7 @@ class SettingsButton extends Button {
213 * Hide all the sub menus 213 * Hide all the sub menus
214 */ 214 */
215 hideChildren () { 215 hideChildren () {
216 for (let menuChild of this.menu.children()) { 216 for (const menuChild of this.menu.children()) {
217 menuChild.hideSubMenu() 217 menuChild.hideSubMenu()
218 } 218 }
219 } 219 }
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 {
167 * @method PrefixedEvent 167 * @method PrefixedEvent
168 */ 168 */
169 PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') { 169 PrefixedEvent (element: any, type: any, callback: any, action = 'addEvent') {
170 let prefix = ['webkit', 'moz', 'MS', 'o', ''] 170 const prefix = ['webkit', 'moz', 'MS', 'o', '']
171 171
172 for (let p = 0; p < prefix.length; p++) { 172 for (let p = 0; p < prefix.length; p++) {
173 if (!prefix[p]) { 173 if (!prefix[p]) {
@@ -249,7 +249,7 @@ class SettingsMenuItem extends MenuItem {
249 249
250 update (event?: any) { 250 update (event?: any) {
251 let target: HTMLElement = null 251 let target: HTMLElement = null
252 let subMenu = this.subMenu.name() 252 const subMenu = this.subMenu.name()
253 253
254 if (event && event.type === 'tap') { 254 if (event && event.type === 'tap') {
255 target = event.target 255 target = event.target
@@ -264,7 +264,7 @@ class SettingsMenuItem extends MenuItem {
264 setTimeout(() => this.settingsSubMenuValueEl_.innerHTML = this.subMenu.labelEl_.innerHTML, 250) 264 setTimeout(() => this.settingsSubMenuValueEl_.innerHTML = this.subMenu.labelEl_.innerHTML, 250)
265 } else { 265 } else {
266 // Loop trough the submenu items to find the selected child 266 // Loop trough the submenu items to find the selected child
267 for (let subMenuItem of this.subMenu.menu.children_) { 267 for (const subMenuItem of this.subMenu.menu.children_) {
268 if (!(subMenuItem instanceof component)) { 268 if (!(subMenuItem instanceof component)) {
269 continue 269 continue
270 } 270 }
@@ -287,7 +287,7 @@ class SettingsMenuItem extends MenuItem {
287 } 287 }
288 288
289 bindClickEvents () { 289 bindClickEvents () {
290 for (let item of this.subMenu.menu.children()) { 290 for (const item of this.subMenu.menu.children()) {
291 if (!(item instanceof component)) { 291 if (!(item instanceof component)) {
292 continue 292 continue
293 } 293 }
@@ -307,7 +307,7 @@ class SettingsMenuItem extends MenuItem {
307 } 307 }
308 308
309 setMargin () { 309 setMargin () {
310 let [width] = this.size 310 const [ width ] = this.size
311 311
312 this.settingsSubMenuEl_.style.marginRight = `-${width}px` 312 this.settingsSubMenuEl_.style.marginRight = `-${width}px`
313 } 313 }
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 {
131 // Chunk in store 131 // Chunk in store
132 this.db.transaction('r', this.db.chunks, async () => { 132 this.db.transaction('r', this.db.chunks, async () => {
133 const result = await this.db.chunks.get({ id: index }) 133 const result = await this.db.chunks.get({ id: index })
134 if (result === undefined) return cb(null, new Buffer(0)) 134 if (result === undefined) return cb(null, Buffer.alloc(0))
135 135
136 const buf = result.buf 136 const buf = result.buf
137 if (!opts) return this.nextTick(cb, null, buf) 137 if (!opts) return this.nextTick(cb, null, buf)
@@ -162,13 +162,13 @@ export class PeertubeChunkStore extends EventEmitter {
162 } 162 }
163 163
164 if (this.db) { 164 if (this.db) {
165 await this.db.close() 165 this.db.close()
166 166
167 await this.dropDatabase(this.databaseName) 167 await this.dropDatabase(this.databaseName)
168 } 168 }
169 169
170 if (this.expirationDB) { 170 if (this.expirationDB) {
171 await this.expirationDB.close() 171 this.expirationDB.close()
172 this.expirationDB = null 172 this.expirationDB = null
173 } 173 }
174 174
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 (
29 29
30function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) { 30function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) {
31 const extension = extname(file.name).toLowerCase() 31 const extension = extname(file.name).toLowerCase()
32 let preparedElem: any = undefined 32 let preparedElem: any
33 let currentTime = 0 33 let currentTime = 0
34 let renderer: any 34 let renderer: any
35 35
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 {
347 if (!averageDownloadSpeed) averageDownloadSpeed = this.getAndSaveActualDownloadSpeed() 347 if (!averageDownloadSpeed) averageDownloadSpeed = this.getAndSaveActualDownloadSpeed()
348 348
349 // Limit resolution according to player height 349 // Limit resolution according to player height
350 const playerHeight = this.playerElement.offsetHeight as number 350 const playerHeight = this.playerElement.offsetHeight
351 351
352 // We take the first resolution just above the player height 352 // We take the first resolution just above the player height
353 // Example: player height is 530px, we want the 720p file instead of 480p 353 // Example: player height is 530px, we want the 720p file instead of 480p
diff --git a/client/src/polyfills.ts b/client/src/polyfills.ts
index 368908432..b68c07fdb 100644
--- a/client/src/polyfills.ts
+++ b/client/src/polyfills.ts
@@ -76,6 +76,7 @@ import 'core-js/es7/object'
76/*************************************************************************************************** 76/***************************************************************************************************
77 * Zone JS is required by default for Angular itself. 77 * Zone JS is required by default for Angular itself.
78 */ 78 */
79// tslint:disable
79import 'zone.js/dist/zone' // Included with Angular CLI. 80import 'zone.js/dist/zone' // Included with Angular CLI.
80 81
81/*************************************************************************************************** 82/***************************************************************************************************
diff --git a/client/src/standalone/player/definitions.ts b/client/src/standalone/player/definitions.ts
index 7f9ef9b6f..afd10541b 100644
--- a/client/src/standalone/player/definitions.ts
+++ b/client/src/standalone/player/definitions.ts
@@ -1,6 +1,4 @@
1export interface EventHandler<T> { 1export type EventHandler<T> = (ev: T) => void
2 (ev: T): void
3}
4 2
5export type PlayerEventType = 3export type PlayerEventType =
6 'pause' | 'play' | 4 'pause' | 'play' |
diff --git a/client/src/standalone/player/events.ts b/client/src/standalone/player/events.ts
index f1639ef19..28a13c727 100644
--- a/client/src/standalone/player/events.ts
+++ b/client/src/standalone/player/events.ts
@@ -13,13 +13,13 @@ export class EventRegistrar {
13 private eventRegistrations: PlayerEventRegistrationMap = {} 13 private eventRegistrations: PlayerEventRegistrationMap = {}
14 14
15 public bindToChannel (channel: Channel.MessagingChannel) { 15 public bindToChannel (channel: Channel.MessagingChannel) {
16 for (let name of Object.keys(this.eventRegistrations)) { 16 for (const name of Object.keys(this.eventRegistrations)) {
17 channel.bind(name, (txn, params) => this.fire(name, params)) 17 channel.bind(name, (txn, params) => this.fire(name, params))
18 } 18 }
19 } 19 }
20 20
21 public registerTypes (names: string[]) { 21 public registerTypes (names: string[]) {
22 for (let name of names) { 22 for (const name of names) {
23 this.eventRegistrations[ name ] = { registrations: [] } 23 this.eventRegistrations[ name ] = { registrations: [] }
24 } 24 }
25 } 25 }
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index b55b4bace..626d55a7c 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -40,7 +40,7 @@ class PeerTubeEmbedApi {
40 } 40 }
41 41
42 private constructChannel () { 42 private constructChannel () {
43 let channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.scope }) 43 const channel = Channel.build({ window: window.parent, origin: '*', scope: this.embed.scope })
44 44
45 channel.bind('play', (txn, params) => this.embed.player.play()) 45 channel.bind('play', (txn, params) => this.embed.player.play())
46 channel.bind('pause', (txn, params) => this.embed.player.pause()) 46 channel.bind('pause', (txn, params) => this.embed.player.pause())
@@ -82,8 +82,8 @@ class PeerTubeEmbedApi {
82 let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted' 82 let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted'
83 83
84 setInterval(() => { 84 setInterval(() => {
85 let position = this.element.currentTime 85 const position = this.element.currentTime
86 let volume = this.element.volume 86 const volume = this.element.volume
87 87
88 this.channel.notify({ 88 this.channel.notify({
89 method: 'playbackStatusUpdate', 89 method: 'playbackStatusUpdate',
@@ -114,8 +114,8 @@ class PeerTubeEmbedApi {
114 } 114 }
115 115
116 private loadWebTorrentResolutions () { 116 private loadWebTorrentResolutions () {
117 let resolutions = [] 117 const resolutions = []
118 let currentResolutionId = this.embed.player.webtorrent().getCurrentResolutionId() 118 const currentResolutionId = this.embed.player.webtorrent().getCurrentResolutionId()
119 119
120 for (const videoFile of this.embed.player.webtorrent().videoFiles) { 120 for (const videoFile of this.embed.player.webtorrent().videoFiles) {
121 let label = videoFile.resolution.label 121 let label = videoFile.resolution.label
@@ -235,7 +235,7 @@ class PeerTubeEmbed {
235 235
236 private loadParams () { 236 private loadParams () {
237 try { 237 try {
238 let params = new URL(window.location.toString()).searchParams 238 const params = new URL(window.location.toString()).searchParams
239 239
240 this.autoplay = this.getParamToggle(params, 'autoplay') 240 this.autoplay = this.getParamToggle(params, 'autoplay')
241 this.controls = this.getParamToggle(params, 'controls') 241 this.controls = this.getParamToggle(params, 'controls')
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts
index 30a298573..8e83d92a9 100644
--- a/client/src/standalone/videos/test-embed.ts
+++ b/client/src/standalone/videos/test-embed.ts
@@ -7,13 +7,13 @@ window.addEventListener('load', async () => {
7 const lastPart = urlParts[ urlParts.length - 1 ] 7 const lastPart = urlParts[ urlParts.length - 1 ]
8 const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ] 8 const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ]
9 9
10 let iframe = document.createElement('iframe') 10 const iframe = document.createElement('iframe')
11 iframe.src = `/videos/embed/${videoId}?autoplay=1&controls=0&api=1` 11 iframe.src = `/videos/embed/${videoId}?autoplay=1&controls=0&api=1`
12 let mainElement = document.querySelector('#host') 12 const mainElement = document.querySelector('#host')
13 mainElement.appendChild(iframe) 13 mainElement.appendChild(iframe)
14 14
15 console.log(`Document finished loading.`) 15 console.log(`Document finished loading.`)
16 let player = new PeerTubePlayer(document.querySelector('iframe')) 16 const player = new PeerTubePlayer(document.querySelector('iframe'))
17 17
18 window[ 'player' ] = player 18 window[ 'player' ] = player
19 19
@@ -21,7 +21,7 @@ window.addEventListener('load', async () => {
21 await player.ready 21 await player.ready
22 console.log(`Player is ready.`) 22 console.log(`Player is ready.`)
23 23
24 let monitoredEvents = [ 24 const monitoredEvents = [
25 'pause', 25 'pause',
26 'play', 26 'play',
27 'playbackStatusUpdate', 27 'playbackStatusUpdate',
@@ -36,18 +36,18 @@ window.addEventListener('load', async () => {
36 let playbackRates: number[] = [] 36 let playbackRates: number[] = []
37 let currentRate = await player.getPlaybackRate() 37 let currentRate = await player.getPlaybackRate()
38 38
39 let updateRates = async () => { 39 const updateRates = async () => {
40 let rateListEl = document.querySelector('#rate-list') 40 const rateListEl = document.querySelector('#rate-list')
41 rateListEl.innerHTML = '' 41 rateListEl.innerHTML = ''
42 42
43 playbackRates.forEach(rate => { 43 playbackRates.forEach(rate => {
44 if (currentRate === rate) { 44 if (currentRate === rate) {
45 let itemEl = document.createElement('strong') 45 const itemEl = document.createElement('strong')
46 itemEl.innerText = `${rate} (active)` 46 itemEl.innerText = `${rate} (active)`
47 itemEl.style.display = 'block' 47 itemEl.style.display = 'block'
48 rateListEl.appendChild(itemEl) 48 rateListEl.appendChild(itemEl)
49 } else { 49 } else {
50 let itemEl = document.createElement('a') 50 const itemEl = document.createElement('a')
51 itemEl.href = 'javascript:;' 51 itemEl.href = 'javascript:;'
52 itemEl.innerText = rate.toString() 52 itemEl.innerText = rate.toString()
53 itemEl.addEventListener('click', () => { 53 itemEl.addEventListener('click', () => {
@@ -66,18 +66,18 @@ window.addEventListener('load', async () => {
66 updateRates() 66 updateRates()
67 }) 67 })
68 68
69 let updateResolutions = ((resolutions: PeerTubeResolution[]) => { 69 const updateResolutions = ((resolutions: PeerTubeResolution[]) => {
70 let resolutionListEl = document.querySelector('#resolution-list') 70 const resolutionListEl = document.querySelector('#resolution-list')
71 resolutionListEl.innerHTML = '' 71 resolutionListEl.innerHTML = ''
72 72
73 resolutions.forEach(resolution => { 73 resolutions.forEach(resolution => {
74 if (resolution.active) { 74 if (resolution.active) {
75 let itemEl = document.createElement('strong') 75 const itemEl = document.createElement('strong')
76 itemEl.innerText = `${resolution.label} (active)` 76 itemEl.innerText = `${resolution.label} (active)`
77 itemEl.style.display = 'block' 77 itemEl.style.display = 'block'
78 resolutionListEl.appendChild(itemEl) 78 resolutionListEl.appendChild(itemEl)
79 } else { 79 } else {
80 let itemEl = document.createElement('a') 80 const itemEl = document.createElement('a')
81 itemEl.href = 'javascript:;' 81 itemEl.href = 'javascript:;'
82 itemEl.innerText = resolution.label 82 itemEl.innerText = resolution.label
83 itemEl.addEventListener('click', () => { 83 itemEl.addEventListener('click', () => {