]>
Commit | Line | Data |
---|---|---|
df98563e | 1 | import { Component, Input, ViewChild } from '@angular/core' |
c7e1e432 JL |
2 | |
3 | import { NotificationsService } from 'angular2-notifications' | |
4 | ||
df98563e | 5 | import { ModalDirective } from 'ngx-bootstrap/modal' |
4635f59d | 6 | import { VideoDetails } from '../../../shared/video/video-details.model' |
960a11e8 | 7 | import { buildVideoEmbed } from '../../../../assets/player/utils' |
cf02fbfb C |
8 | |
9 | @Component({ | |
10 | selector: 'my-video-share', | |
c7e1e432 JL |
11 | templateUrl: './video-share.component.html', |
12 | styleUrls: [ './video-share.component.scss' ] | |
cf02fbfb C |
13 | }) |
14 | export class VideoShareComponent { | |
404b54e1 | 15 | @Input() video: VideoDetails = null |
cf02fbfb | 16 | |
df98563e | 17 | @ViewChild('modal') modal: ModalDirective |
cf02fbfb | 18 | |
c7e1e432 | 19 | constructor (private notificationsService: NotificationsService) { |
cf02fbfb C |
20 | // empty |
21 | } | |
22 | ||
df98563e C |
23 | show () { |
24 | this.modal.show() | |
cf02fbfb C |
25 | } |
26 | ||
df98563e C |
27 | hide () { |
28 | this.modal.hide() | |
cf02fbfb C |
29 | } |
30 | ||
df98563e | 31 | getVideoIframeCode () { |
960a11e8 | 32 | return buildVideoEmbed(this.video.embedUrl) |
cf02fbfb C |
33 | } |
34 | ||
df98563e C |
35 | getVideoUrl () { |
36 | return window.location.href | |
cf02fbfb | 37 | } |
2c8d4697 | 38 | |
df98563e C |
39 | notSecure () { |
40 | return window.location.protocol === 'http:' | |
2c8d4697 | 41 | } |
c7e1e432 JL |
42 | |
43 | activateCopiedMessage () { | |
44 | this.notificationsService.success('Success', 'Copied') | |
45 | } | |
cf02fbfb | 46 | } |