1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-26 02:50: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) { 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;
switch (event.which) { if (event.shiftKey) {
case 37: //left switch (event.which) {
clickPrev(); case 83: //S
break; sendAPI({"cmd": "MPD_API_QUEUE_SHUFFLE"});
case 39: //right break;
clickNext(); case 67: //C
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)
sendAPI({"cmd": "MPD_API_QUEUE_CROP"}); 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"}); sendAPI({"cmd": "MPD_API_QUEUE_CLEAR"});
break; break;
default: default:
return; return;
}
} }
event.preventDefault(); event.preventDefault();
}, false); }, false);