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