projects
/
ympd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f2164b3
)
Add arrow left/right and spacebar controls
author
Daniel Wyatt
<Daniel.Wyatt@gmail.com>
Sun, 13 Sep 2015 08:38:18 +0000
(
04:38
-0400)
committer
Daniel Wyatt
<Daniel.Wyatt@gmail.com>
Sun, 13 Sep 2015 08:38:18 +0000
(
04:38
-0400)
htdocs/js/mpd.js
patch
|
blob
|
history
diff --git
a/htdocs/js/mpd.js
b/htdocs/js/mpd.js
index
49a4656
..
4e58fd0
100644
(file)
--- a/
htdocs/js/mpd.js
+++ b/
htdocs/js/mpd.js
@@
-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();
+});