]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/+video-watch/modal/video-share.component.ts
5c988a43b51fb3797d7a53ce116b8cc6bdd1189e
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / modal / video-share.component.ts
1 import { Component, Input, ViewChild } from '@angular/core'
2
3 import { NotificationsService } from 'angular2-notifications'
4
5 import { ModalDirective } from 'ngx-bootstrap/modal'
6 import { VideoDetails } from '../../../shared/video/video-details.model'
7 import { buildVideoEmbed } from '../../../../assets/player/utils'
8 import { I18n } from '@ngx-translate/i18n-polyfill'
9
10 @Component({
11 selector: 'my-video-share',
12 templateUrl: './video-share.component.html',
13 styleUrls: [ './video-share.component.scss' ]
14 })
15 export class VideoShareComponent {
16 @Input() video: VideoDetails = null
17
18 @ViewChild('modal') modal: ModalDirective
19
20 constructor (
21 private notificationsService: NotificationsService,
22 private i18n: I18n
23 ) {
24 // empty
25 }
26
27 show () {
28 this.modal.show()
29 }
30
31 hide () {
32 this.modal.hide()
33 }
34
35 getVideoIframeCode () {
36 return buildVideoEmbed(this.video.embedUrl)
37 }
38
39 getVideoUrl () {
40 return window.location.href
41 }
42
43 notSecure () {
44 return window.location.protocol === 'http:'
45 }
46
47 activateCopiedMessage () {
48 this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))
49 }
50 }