Permalink
Browse files

[webui] Add keyboard controls to web remote

  • Loading branch information...
1 parent a8a90e0 commit 05bfc59bb0824448fbe69f244c795413832c9d01 @davidbanham davidbanham committed Mar 31, 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 05bfc59

Please sign in to comment.