Permalink
Browse files

Merge pull request #4494 from davidbanham/master

Add keyboard controls to web remote
  • Loading branch information...
2 parents e6e95dd + 05bfc59 commit 29b2e533f63e2f8c786bc9413d38f4bea56ccb90 @t-nelson t-nelson committed Apr 4, 2014
Showing with 21 additions and 0 deletions.
  1. +21 −0 addons/webinterface.default/js/NowPlayingManager.js
@@ -141,6 +141,27 @@ NowPlayingManager.prototype = {
$('#pbStop').bind('click', jQuery.proxy(this.stopTrack, this));
$('#pbPlay').bind('click', jQuery.proxy(this.playPauseTrack, this));
$('#pbPause').bind('click', jQuery.proxy(this.playPauseTrack, this));
+ that = this
+ $(document).keypress(function(event) {
+ switch (event.which) {
+ case 32: //spacebar
+ event.preventDefault()
+ jQuery.proxy(that.playPauseTrack, that)();
+ break;
+ case 120: //x key
+ event.preventDefault()
+ jQuery.proxy(that.stopTrack, that)();
+ break;
+ case 44: //period key
+ event.preventDefault()
+ jQuery.proxy(that.nextTrack, that)();
+ break;
+ case 46: //comma key
+ event.preventDefault()
+ jQuery.proxy(that.prevTrack, that)();
+ break;
+ }
+ });
},
showPlaylist: function() {
$('#nextText').html('Playlist: ');

0 comments on commit 29b2e53

Please sign in to comment.