Add arrow left/right and spacebar controls

This commit is contained in:
Daniel Wyatt 2015-09-13 04:38:18 -04:00
parent f2164b382a
commit 86d2d2ecb4
1 changed files with 20 additions and 0 deletions

View File

@ -628,3 +628,23 @@ function songNotify(title, artist, album) {
notification.close();
}, 3000, notification);
}
$(document).keydown(function(e){
if (e.target.tagName == 'INPUT') {
return;
}
switch (e.which) {
case 37: //left
socket.send('MPD_API_SET_PREV');
break;
case 39: //right
socket.send('MPD_API_SET_NEXT');
break;
case 32: //space
clickPlay();
break;
default:
return;
}
e.preventDefault();
});