]>
Commit | Line | Data |
---|---|---|
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 | ||
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: ModalDirective | |
17 | ||
18 | constructor (private notificationsService: NotificationsService) { | |
19 | // empty | |
20 | } | |
21 | ||
22 | show () { | |
23 | this.modal.show() | |
24 | } | |
25 | ||
26 | hide () { | |
27 | this.modal.hide() | |
28 | } | |
29 | ||
30 | getVideoIframeCode () { | |
31 | return '<iframe width="560" height="315" ' + | |
32 | 'src="' + this.video.embedUrl + '" ' + | |
33 | 'frameborder="0" allowfullscreen>' + | |
34 | '</iframe>' | |
35 | } | |
36 | ||
37 | getVideoUrl () { | |
38 | return window.location.href | |
39 | } | |
40 | ||
41 | notSecure () { | |
42 | return window.location.protocol === 'http:' | |
43 | } | |
44 | ||
45 | activateCopiedMessage () { | |
46 | this.notificationsService.success('Success', 'Copied') | |
47 | } | |
48 | } |