]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/+video-watch/modal/video-share.component.ts
Add context menu to player
[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
9 @Component({
10 selector: 'my-video-share',
11 templateUrl: './video-share.component.html',
12 styleUrls: [ './video-share.component.scss' ]
13 })
14 export class VideoShareComponent {
15 @Input() video: VideoDetails = null
16
17 @ViewChild('modal') modal: ModalDirective
18
19 constructor (private notificationsService: NotificationsService) {
20 // empty
21 }
22
23 show () {
24 this.modal.show()
25 }
26
27 hide () {
28 this.modal.hide()
29 }
30
31 getVideoIframeCode () {
32 return buildVideoEmbed(this.video.embedUrl)
33 }
34
35 getVideoUrl () {
36 return window.location.href
37 }
38
39 notSecure () {
40 return window.location.protocol === 'http:'
41 }
42
43 activateCopiedMessage () {
44 this.notificationsService.success('Success', 'Copied')
45 }
46 }