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