diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-27 16:11:53 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-27 16:11:53 +0100 |
commit | 4635f59d7c3fea4b97029f10886c62fdf38b2084 (patch) | |
tree | d97357a00042bbfb33c4177ee24c01171d28dfce /client/src/app/videos/+video-watch/video-download.component.ts | |
parent | ea44f375f5d3da06ca0aebfe871b9f924a26ec29 (diff) | |
download | PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.gz PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.zst PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.zip |
Add video comment components
Diffstat (limited to 'client/src/app/videos/+video-watch/video-download.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/video-download.component.ts | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/client/src/app/videos/+video-watch/video-download.component.ts b/client/src/app/videos/+video-watch/video-download.component.ts deleted file mode 100644 index 44ece986c..000000000 --- a/client/src/app/videos/+video-watch/video-download.component.ts +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | ||
2 | import { ModalDirective } from 'ngx-bootstrap/modal' | ||
3 | import { VideoDetails } from '../../shared/video/video-details.model' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-video-download', | ||
7 | templateUrl: './video-download.component.html', | ||
8 | styleUrls: [ './video-download.component.scss' ] | ||
9 | }) | ||
10 | export class VideoDownloadComponent implements OnInit { | ||
11 | @Input() video: VideoDetails = null | ||
12 | |||
13 | @ViewChild('modal') modal: ModalDirective | ||
14 | |||
15 | downloadType: 'direct' | 'torrent' = 'torrent' | ||
16 | resolution = -1 | ||
17 | |||
18 | constructor () { | ||
19 | // empty | ||
20 | } | ||
21 | |||
22 | ngOnInit () { | ||
23 | this.resolution = this.video.files[0].resolution | ||
24 | } | ||
25 | |||
26 | show () { | ||
27 | this.modal.show() | ||
28 | } | ||
29 | |||
30 | hide () { | ||
31 | this.modal.hide() | ||
32 | } | ||
33 | |||
34 | download () { | ||
35 | const file = this.video.files.find(f => f.resolution === this.resolution) | ||
36 | if (!file) { | ||
37 | console.error('Could not find file with resolution %d.', this.resolution) | ||
38 | return | ||
39 | } | ||
40 | |||
41 | const link = this.downloadType === 'direct' ? file.fileUrl : file.torrentUrl | ||
42 | window.open(link) | ||
43 | } | ||
44 | } | ||