1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-25 10:30:26 +00:00

Fix: differentiate between lower and upper case keyboard shortcuts

This commit is contained in:
jcorporation 2018-10-01 23:02:49 +01:00
parent 87872f0554
commit 7a6d000e58

View File

@ -569,33 +569,44 @@ function appInit() {
document.addEventListener('keydown', function(event) {
if (event.target.tagName == 'INPUT' || event.target.tagName == 'SELECT')
return;
switch (event.which) {
case 37: //left
clickPrev();
break;
case 39: //right
clickNext();
break;
case 32: //space
clickPlay();
break;
case 83: //s
clickStop();
break;
case 173: //-
chVolume(-5);
break;
case 171: //+
chVolume(5);
break;
case 67: //C c
if (event.shiftKey)
if (event.shiftKey) {
switch (event.which) {
case 83: //S
sendAPI({"cmd": "MPD_API_QUEUE_SHUFFLE"});
break;
case 67: //C
sendAPI({"cmd": "MPD_API_QUEUE_CROP"});
else
break;
default:
return;
}
}
else {
switch (event.which) {
case 37: //left
clickPrev();
break;
case 39: //right
clickNext();
break;
case 32: //space
clickPlay();
break;
case 83: //s
clickStop();
break;
case 173: //-
chVolume(-5);
break;
case 171: //+
chVolume(5);
break;
case 67: //c
sendAPI({"cmd": "MPD_API_QUEUE_CLEAR"});
break;
default:
return;
break;
default:
return;
}
}
event.preventDefault();
}, false);