1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-01-13 19:00:37 +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,6 +569,19 @@ function appInit() {
document.addEventListener('keydown', function(event) { document.addEventListener('keydown', function(event) {
if (event.target.tagName == 'INPUT' || event.target.tagName == 'SELECT') if (event.target.tagName == 'INPUT' || event.target.tagName == 'SELECT')
return; return;
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"});
break;
default:
return;
}
}
else {
switch (event.which) { switch (event.which) {
case 37: //left case 37: //left
clickPrev(); clickPrev();
@ -588,15 +601,13 @@ function appInit() {
case 171: //+ case 171: //+
chVolume(5); chVolume(5);
break; break;
case 67: //C c case 67: //c
if (event.shiftKey)
sendAPI({"cmd": "MPD_API_QUEUE_CROP"});
else
sendAPI({"cmd": "MPD_API_QUEUE_CLEAR"}); sendAPI({"cmd": "MPD_API_QUEUE_CLEAR"});
break; break;
default: default:
return; return;
} }
}
event.preventDefault(); event.preventDefault();
}, false); }, false);