aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts31
1 files changed, 30 insertions, 1 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 2149768a2..a69f419be 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -5,6 +5,7 @@ import { AuthService, RedirectService, ServerService } from '@app/core'
5import { is18nPath } from '../../../shared/models/i18n' 5import { is18nPath } from '../../../shared/models/i18n'
6import { ScreenService } from '@app/shared/misc/screen.service' 6import { ScreenService } from '@app/shared/misc/screen.service'
7import { skip } from 'rxjs/operators' 7import { skip } from 'rxjs/operators'
8import { HotkeysService, Hotkey } from 'angular2-hotkeys'
8 9
9@Component({ 10@Component({
10 selector: 'my-app', 11 selector: 'my-app',
@@ -35,7 +36,8 @@ export class AppComponent implements OnInit {
35 private serverService: ServerService, 36 private serverService: ServerService,
36 private domSanitizer: DomSanitizer, 37 private domSanitizer: DomSanitizer,
37 private redirectService: RedirectService, 38 private redirectService: RedirectService,
38 private screenService: ScreenService 39 private screenService: ScreenService,
40 private hotkeysService: HotkeysService
39 ) { } 41 ) { }
40 42
41 get serverVersion () { 43 get serverVersion () {
@@ -120,6 +122,33 @@ export class AppComponent implements OnInit {
120 this.customCSS = this.domSanitizer.bypassSecurityTrustHtml(styleTag) 122 this.customCSS = this.domSanitizer.bypassSecurityTrustHtml(styleTag)
121 } 123 }
122 }) 124 })
125
126 this.hotkeysService.add([
127 new Hotkey('/', (event: KeyboardEvent): boolean => {
128 document.getElementById('search-video').focus()
129 return false // Prevent bubbling
130 }, undefined, 'Focus the search bar'),
131 new Hotkey('g+s', (event: KeyboardEvent): boolean => {
132 this.router.navigate([ '/videos/subscriptions' ])
133 return false
134 }, undefined, 'Go to the subscriptions videos page'),
135 new Hotkey('g+t', (event: KeyboardEvent): boolean => {
136 this.router.navigate([ '/videos/trending' ])
137 return false
138 }, undefined, 'Go to the trending videos page'),
139 new Hotkey('g+r', (event: KeyboardEvent): boolean => {
140 this.router.navigate([ '/videos/recently-added' ])
141 return false
142 }, undefined, 'Go to the recently added videos page'),
143 new Hotkey('g+l', (event: KeyboardEvent): boolean => {
144 this.router.navigate([ '/videos/local' ])
145 return false
146 }, undefined, 'Go to the local videos page'),
147 new Hotkey('g+u', (event: KeyboardEvent): boolean => {
148 this.router.navigate([ '/videos/upload' ])
149 return false
150 }, undefined, 'Go to the videos upload page')
151 ])
123 } 152 }
124 153
125 isUserLoggedIn () { 154 isUserLoggedIn () {