diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-04 16:23:18 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-04 16:23:18 +0100 |
commit | 3154f38219ea6eb55532f38fee43d46821a020ee (patch) | |
tree | baa5586d83de77387b4559fe6e98e3a95334cbc0 /client/src/app/videos | |
parent | d1992b93f0f4a4408f803d6320cd26a713e22d5b (diff) | |
download | PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.tar.gz PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.tar.zst PeerTube-3154f38219ea6eb55532f38fee43d46821a020ee.zip |
Client: allow to copy magnet uri
Diffstat (limited to 'client/src/app/videos')
-rw-r--r-- | client/src/app/videos/video-watch/video-watch.component.html | 19 | ||||
-rw-r--r-- | client/src/app/videos/video-watch/video-watch.component.ts | 14 |
2 files changed, 31 insertions, 2 deletions
diff --git a/client/src/app/videos/video-watch/video-watch.component.html b/client/src/app/videos/video-watch/video-watch.component.html index 14947da88..d75ed3538 100644 --- a/client/src/app/videos/video-watch/video-watch.component.html +++ b/client/src/app/videos/video-watch/video-watch.component.html | |||
@@ -50,7 +50,7 @@ | |||
50 | </div> | 50 | </div> |
51 | 51 | ||
52 | <div id="video-actions" class="col-md-4 text-right"> | 52 | <div id="video-actions" class="col-md-4 text-right"> |
53 | <button title="Get magnet URI" id="magnet-uri" class="btn btn-default"> | 53 | <button title="Get magnet URI" id="magnet-uri" class="btn btn-default" (click)="showMagnetUriModal()"> |
54 | <span class="glyphicon glyphicon-magnet"></span> Magnet | 54 | <span class="glyphicon glyphicon-magnet"></span> Magnet |
55 | </button> | 55 | </button> |
56 | </div> | 56 | </div> |
@@ -72,3 +72,20 @@ | |||
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
74 | 74 | ||
75 | <div *ngIf="video !== null" bsModal #magnetUriModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="magnetUriModal" aria-hidden="true"> | ||
76 | <div class="modal-dialog"> | ||
77 | <div class="modal-content"> | ||
78 | |||
79 | <div class="modal-header"> | ||
80 | <button type="button" class="close" aria-label="Close" (click)="hideMagnetUriModal()"> | ||
81 | <span aria-hidden="true">×</span> | ||
82 | </button> | ||
83 | <h4 class="modal-title">Magnet Uri</h4> | ||
84 | </div> | ||
85 | |||
86 | <div class="modal-body"> | ||
87 | <input #magnetUriInput (click)="magnetUriInput.select()" type="text" class="form-control input-sm" readonly [value]="video.magnetUri" /> | ||
88 | </div> | ||
89 | </div> | ||
90 | </div> | ||
91 | </div> | ||
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts index 9a36c17e2..736ca7d5a 100644 --- a/client/src/app/videos/video-watch/video-watch.component.ts +++ b/client/src/app/videos/video-watch/video-watch.component.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core'; | 1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; |
2 | import { ActivatedRoute } from '@angular/router'; | 2 | import { ActivatedRoute } from '@angular/router'; |
3 | 3 | ||
4 | import { ModalDirective } from 'ng2-bootstrap/components/modal'; | ||
5 | |||
4 | import { Video, VideoService } from '../shared'; | 6 | import { Video, VideoService } from '../shared'; |
5 | import { WebTorrentService } from './webtorrent.service'; | 7 | import { WebTorrentService } from './webtorrent.service'; |
6 | 8 | ||
@@ -13,6 +15,8 @@ import { WebTorrentService } from './webtorrent.service'; | |||
13 | export class VideoWatchComponent implements OnInit, OnDestroy { | 15 | export class VideoWatchComponent implements OnInit, OnDestroy { |
14 | private static LOADTIME_TOO_LONG: number = 30000; | 16 | private static LOADTIME_TOO_LONG: number = 30000; |
15 | 17 | ||
18 | @ViewChild('magnetUriModal') magnetUriModal: ModalDirective; | ||
19 | |||
16 | downloadSpeed: number; | 20 | downloadSpeed: number; |
17 | error: boolean = false; | 21 | error: boolean = false; |
18 | loading: boolean = false; | 22 | loading: boolean = false; |
@@ -87,6 +91,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
87 | }); | 91 | }); |
88 | } | 92 | } |
89 | 93 | ||
94 | showMagnetUriModal() { | ||
95 | this.magnetUriModal.show(); | ||
96 | } | ||
97 | |||
98 | hideMagnetUriModal() { | ||
99 | this.magnetUriModal.hide(); | ||
100 | } | ||
101 | |||
90 | private loadTooLong() { | 102 | private loadTooLong() { |
91 | this.error = true; | 103 | this.error = true; |
92 | console.error('The video load seems to be abnormally long.'); | 104 | console.error('The video load seems to be abnormally long.'); |