Added normal +/- keys to audio player

This commit is contained in:
Eduard Urbach 2018-03-16 17:34:29 +01:00
parent be2660df80
commit 2aec328e9c

View File

@ -824,8 +824,22 @@ export class AnimeNotifier {
return return
} }
// "Ctrl" + "," = Settings
if(e.ctrlKey && e.keyCode == 188) {
this.app.load("/settings")
e.preventDefault()
e.stopPropagation()
return
}
// The following keycodes should not be activated while Ctrl is held down
if(e.ctrlKey) {
return
}
// "F" = Search // "F" = Search
if(e.keyCode == 70 && !e.ctrlKey) { if(e.keyCode == 70) {
let search = this.app.find("search") as HTMLInputElement let search = this.app.find("search") as HTMLInputElement
search.focus() search.focus()
@ -837,7 +851,7 @@ export class AnimeNotifier {
} }
// "S" = Toggle sidebar // "S" = Toggle sidebar
if(e.keyCode == 83 && !e.ctrlKey) { if(e.keyCode == 83) {
this.sideBar.toggle() this.sideBar.toggle()
e.preventDefault() e.preventDefault()
@ -846,7 +860,7 @@ export class AnimeNotifier {
} }
// "+" = Audio speed up // "+" = Audio speed up
if(e.keyCode == 107 && !e.ctrlKey) { if(e.keyCode == 107 || e.keyCode == 187) {
addSpeed(this, 0.05) addSpeed(this, 0.05)
e.preventDefault() e.preventDefault()
@ -855,7 +869,7 @@ export class AnimeNotifier {
} }
// "-" = Audio speed down // "-" = Audio speed down
if(e.keyCode == 109 && !e.ctrlKey) { if(e.keyCode == 109 || e.keyCode == 189) {
addSpeed(this, -0.05) addSpeed(this, -0.05)
e.preventDefault() e.preventDefault()
@ -864,7 +878,7 @@ export class AnimeNotifier {
} }
// "J" = Previous track // "J" = Previous track
if(e.keyCode == 74 && !e.ctrlKey) { if(e.keyCode == 74) {
playPreviousTrack(this) playPreviousTrack(this)
e.preventDefault() e.preventDefault()
@ -873,7 +887,7 @@ export class AnimeNotifier {
} }
// "K" = Play/pause // "K" = Play/pause
if(e.keyCode == 75 && !e.ctrlKey) { if(e.keyCode == 75) {
playPauseAudio(this) playPauseAudio(this)
e.preventDefault() e.preventDefault()
@ -882,21 +896,12 @@ export class AnimeNotifier {
} }
// "L" = Next track // "L" = Next track
if(e.keyCode == 76 && !e.ctrlKey) { if(e.keyCode == 76) {
playNextTrack(this) playNextTrack(this)
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
return return
} }
// "Ctrl" + "," = Settings
if(e.ctrlKey && e.keyCode == 188) {
this.app.load("/settings")
e.preventDefault()
e.stopPropagation()
return
}
} }
} }