diff options
Diffstat (limited to 'client/src/app/videos')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 38 |
1 files changed, 21 insertions, 17 deletions
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 b147b75b0..631504eab 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -119,23 +119,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
119 | if (videoId) this.loadVideo(videoId) | 119 | if (videoId) this.loadVideo(videoId) |
120 | }) | 120 | }) |
121 | 121 | ||
122 | this.hotkeys = [ | 122 | this.initHotkeys() |
123 | new Hotkey('shift+l', (event: KeyboardEvent): boolean => { | ||
124 | this.setLike() | ||
125 | return false | ||
126 | }, undefined, this.i18n('Like the video')), | ||
127 | new Hotkey('shift+d', (event: KeyboardEvent): boolean => { | ||
128 | this.setDislike() | ||
129 | return false | ||
130 | }, undefined, this.i18n('Dislike the video')), | ||
131 | new Hotkey('shift+s', (event: KeyboardEvent): boolean => { | ||
132 | this.subscribeButton.subscribed ? | ||
133 | this.subscribeButton.unsubscribe() : | ||
134 | this.subscribeButton.subscribe() | ||
135 | return false | ||
136 | }, undefined, this.i18n('Subscribe to the account')) | ||
137 | ] | ||
138 | if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys) | ||
139 | } | 123 | } |
140 | 124 | ||
141 | ngOnDestroy () { | 125 | ngOnDestroy () { |
@@ -565,4 +549,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
565 | this.player = undefined | 549 | this.player = undefined |
566 | } | 550 | } |
567 | } | 551 | } |
552 | |||
553 | private initHotkeys () { | ||
554 | this.hotkeys = [ | ||
555 | new Hotkey('shift+l', (event: KeyboardEvent): boolean => { | ||
556 | this.setLike() | ||
557 | return false | ||
558 | }, undefined, this.i18n('Like the video')), | ||
559 | new Hotkey('shift+d', (event: KeyboardEvent): boolean => { | ||
560 | this.setDislike() | ||
561 | return false | ||
562 | }, undefined, this.i18n('Dislike the video')), | ||
563 | new Hotkey('shift+s', (event: KeyboardEvent): boolean => { | ||
564 | this.subscribeButton.subscribed ? | ||
565 | this.subscribeButton.unsubscribe() : | ||
566 | this.subscribeButton.subscribe() | ||
567 | return false | ||
568 | }, undefined, this.i18n('Subscribe to the account')) | ||
569 | ] | ||
570 | if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys) | ||
571 | } | ||
568 | } | 572 | } |