aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/modal/video-download.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-24 10:40:27 +0200
committerGitHub <noreply@github.com>2018-09-24 10:40:27 +0200
commit0b4e5fe32708afce54212810738aa4d0c3dc178d (patch)
tree5d9b160e257a2bd116e67c9363b798f422ead44c /client/src/app/videos/+video-watch/modal/video-download.component.ts
parent23db998f07d674c621972a769df73203b14e093a (diff)
parent01448622992b12318a2fff508e501732b59dd6be (diff)
downloadPeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.tar.gz
PeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.tar.zst
PeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.zip
Merge branch 'develop' into unused-imports
Diffstat (limited to 'client/src/app/videos/+video-watch/modal/video-download.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/modal/video-download.component.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.ts b/client/src/app/videos/+video-watch/modal/video-download.component.ts
index f4d9003ee..b1b2c0623 100644
--- a/client/src/app/videos/+video-watch/modal/video-download.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-download.component.ts
@@ -1,6 +1,8 @@
1import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'
2import { VideoDetails } from '../../../shared/video/video-details.model' 2import { VideoDetails } from '../../../shared/video/video-details.model'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { NotificationsService } from 'angular2-notifications'
4 6
5@Component({ 7@Component({
6 selector: 'my-video-download', 8 selector: 'my-video-download',
@@ -15,7 +17,11 @@ export class VideoDownloadComponent implements OnInit {
15 downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent' 17 downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
16 resolutionId: number | string = -1 18 resolutionId: number | string = -1
17 19
18 constructor (private modalService: NgbModal) { } 20 constructor (
21 private notificationsService: NotificationsService,
22 private modalService: NgbModal,
23 private i18n: I18n
24 ) { }
19 25
20 ngOnInit () { 26 ngOnInit () {
21 this.resolutionId = this.video.files[0].resolution.id 27 this.resolutionId = this.video.files[0].resolution.id
@@ -26,6 +32,10 @@ export class VideoDownloadComponent implements OnInit {
26 } 32 }
27 33
28 download () { 34 download () {
35 window.location.assign(this.getLink())
36 }
37
38 getLink () {
29 // HTML select send us a string, so convert it to a number 39 // HTML select send us a string, so convert it to a number
30 this.resolutionId = parseInt(this.resolutionId.toString(), 10) 40 this.resolutionId = parseInt(this.resolutionId.toString(), 10)
31 41
@@ -48,6 +58,11 @@ export class VideoDownloadComponent implements OnInit {
48 } 58 }
49 } 59 }
50 })() 60 })()
51 window.location.assign(link) 61
62 return link
63 }
64
65 activateCopiedMessage () {
66 this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))
52 } 67 }
53} 68}