diff --git a/channel.js b/channel.js index efc48356..a3fad52d 100644 --- a/channel.js +++ b/channel.js @@ -437,9 +437,10 @@ Channel.prototype.unqueue = function(data) { // Play the next media in the queue Channel.prototype.playNext = function() { - if(this.currentPosition + 1 >= this.queue.length) { - this.currentMedia = null; + if(this.queue.length == 0) return; + if(this.currentPosition + 1 >= this.queue.length) { + this.currentPosition = -1; } this.currentPosition++; this.currentMedia = this.queue[this.currentPosition]; diff --git a/user.js b/user.js index 01863a7b..77874a7e 100644 --- a/user.js +++ b/user.js @@ -107,16 +107,14 @@ User.prototype.initCallbacks = function() { }.bind(this)); this.socket.on('unqueue', function(data) { - if(Rank.hasPermission(this, "queue") || - (this.channel != null && !this.channel.qlocked)) { + if(Rank.hasPermission(this, "queue")) { if(this.channel != null) this.channel.unqueue(data); } }.bind(this)); this.socket.on('moveMedia', function(data) { - if(Rank.hasPermission(this, "queue") || - (this.channel != null && !this.channel.qlocked)) { + if(Rank.hasPermission(this, "queue")) { if(this.channel != null) this.channel.moveMedia(data); } @@ -124,8 +122,7 @@ User.prototype.initCallbacks = function() { this.socket.on('playNext', function() { if(Rank.hasPermission(this, "queue") || - (this.channel != null && ( - this.channel.leader == this || !this.channel.qlocked))) { + (this.channel != null && this.channel.leader == this)) { if(this.channel.currentPosition + 1 >= this.channel.queue.length) { this.channel.currentPosition = -1; } diff --git a/www/assets/js/client.js b/www/assets/js/client.js index 4e960f75..848d8613 100644 --- a/www/assets/js/client.js +++ b/www/assets/js/client.js @@ -173,7 +173,7 @@ $('#register').click(function() { }); $('#chatline').keydown(function(ev) { - if(ev.keyCode == 13) { + if(ev.keyCode == 13 && $('#chatline').val() != '') { socket.emit('chatMsg', { msg: $('#chatline').val() });