return text
}
- canDeactivate (): { canDeactivate: boolean, text?: string} {
+ canDeactivate (): { canDeactivate: boolean, text?: string } {
if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate()
if (this.secondStepType === 'import-torrent') return this.videoImportTorrent.canDeactivate()
import { Observable, of as ofObservable, timer as observableTimer } from 'rxjs'
import { switchMap } from 'rxjs/operators'
-import { PreloadingStrategy, Route } from '@angular/router'
import { Injectable } from '@angular/core'
+import { PreloadingStrategy, Route } from '@angular/router'
@Injectable()
export class PreloadSelectedModulesList implements PreloadingStrategy {
preload (route: Route, load: () => Observable<any>): Observable<any> {
- if (!route.data || !route.data.preload) return ofObservable(null)
+ if (!route.data?.preload) return ofObservable(null)
if (typeof route.data.preload === 'number') {
return observableTimer(route.data.preload).pipe(switchMap(() => load()))
static getDecimalForNumber (x: number, n = 1) {
const v = x.toString().split('.')
const f = v[1] || ''
- if (f.length > n) return +f.substr(0, n)
+ if (f.length > n) return +f.substring(0, n)
return +f
}
- private dictionary: Array<{max: number, type: string}> = [
+ private dictionary: Array<{ max: number, type: string }> = [
{ max: 1000, type: '' },
{ max: 1000000, type: 'K' },
{ max: 1000000000, type: 'M' }
})
export class ListOverflowComponent<T extends ListOverflowItem> implements AfterViewInit {
@Input() items: T[]
- @Input() itemTemplate: TemplateRef<{item: T}>
+ @Input() itemTemplate: TemplateRef<{ item: T }>
@ViewChild('modal', { static: true }) modal: ElementRef
@ViewChild('itemsParent', { static: true }) parent: ElementRef<HTMLDivElement>
import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoFileTokenService, VideoService } from '../shared-main'
type DownloadType = 'video' | 'subtitles'
-type FileMetadata = { [key: string]: { label: string, value: string }}
+type FileMetadata = { [key: string]: { label: string, value: string } }
@Component({
selector: 'my-video-download',
}
buildRouterQuery () {
- if (!this.playlistElement || !this.playlistElement.video) return {}
+ if (!this.playlistElement?.video) return {}
return {
playlistPosition: this.playlistElement.position,
// https://github.com/danrevah/ngx-pipes/blob/master/src/pipes/math/bytes.ts
// Don't import all Angular stuff, just copy the code with shame
-const dictionaryBytes: Array<{max: number, type: string}> = [
+const dictionaryBytes: Array<{ max: number, type: string }> = [
{ max: 1024, type: 'B' },
{ max: 1048576, type: 'KB' },
{ max: 1073741824, type: 'MB' },
const next = this.playlistElements.find(e => e.position === position)
- if (!next || !next.video) {
+ if (!next?.video) {
return this.getNextPlaylistElement(position + 1)
}
const prev = this.playlistElements.find(e => e.position === position)
- if (!prev || !prev.video) {
+ if (!prev?.video) {
return this.getNextPlaylistElement(position - 1)
}
setPosition (position: number) {
this.currentPlaylistElement = this.playlistElements.find(e => e.position === position)
- if (!this.currentPlaylistElement || !this.currentPlaylistElement.video) {
+ if (!this.currentPlaylistElement?.video) {
logger.error('Current playlist element is not valid.', this.currentPlaylistElement)
this.currentPlaylistElement = this.getNextPlaylistElement()
}
{
"extends": "../../../tsconfig.json",
"include": [
- "src/standalone/videos/embed.ts",
- "src/standalone/videos/test-embed.ts"
+ "./embed.ts",
+ "./test-embed.ts"
]
}