]>
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' |
b1d40cff | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
cf02fbfb C |
9 | |
10 | @Component({ | |
11 | selector: 'my-video-share', | |
c7e1e432 JL |
12 | templateUrl: './video-share.component.html', |
13 | styleUrls: [ './video-share.component.scss' ] | |
cf02fbfb C |
14 | }) |
15 | export class VideoShareComponent { | |
404b54e1 | 16 | @Input() video: VideoDetails = null |
cf02fbfb | 17 | |
df98563e | 18 | @ViewChild('modal') modal: ModalDirective |
cf02fbfb | 19 | |
b1d40cff C |
20 | constructor ( |
21 | private notificationsService: NotificationsService, | |
22 | private i18n: I18n | |
23 | ) { | |
cf02fbfb C |
24 | // empty |
25 | } | |
26 | ||
df98563e C |
27 | show () { |
28 | this.modal.show() | |
cf02fbfb C |
29 | } |
30 | ||
df98563e C |
31 | hide () { |
32 | this.modal.hide() | |
cf02fbfb C |
33 | } |
34 | ||
df98563e | 35 | getVideoIframeCode () { |
960a11e8 | 36 | return buildVideoEmbed(this.video.embedUrl) |
cf02fbfb C |
37 | } |
38 | ||
df98563e C |
39 | getVideoUrl () { |
40 | return window.location.href | |
cf02fbfb | 41 | } |
2c8d4697 | 42 | |
df98563e C |
43 | notSecure () { |
44 | return window.location.protocol === 'http:' | |
2c8d4697 | 45 | } |
c7e1e432 JL |
46 | |
47 | activateCopiedMessage () { | |
b1d40cff | 48 | this.notificationsService.success(this.i18n('Success'), this.i18n('Copied')) |
c7e1e432 | 49 | } |
cf02fbfb | 50 | } |