From 8f72854e3829ce0d495f156be6415da5129f1ef9 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 1 Aug 2013 15:12:57 -0400 Subject: [PATCH 1/4] Fix #238 --- user.js | 8 ++++++-- www/assets/js/callbacks.js | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/user.js b/user.js index ba946344..c251a327 100644 --- a/user.js +++ b/user.js @@ -83,7 +83,8 @@ User.prototype.noflood = function(name, hz) { User.prototype.setAFK = function (afk) { if(this.channel === null) return; - var changed = this.meta.afk != afk; + if(this.meta.afk === afk) + return; var chan = this.channel; this.meta.afk = afk; if(afk) { @@ -96,7 +97,10 @@ User.prototype.setAFK = function (afk) { this.autoAFK(); } chan.checkVoteskipPass(); - chan.broadcastUserUpdate(this); + chan.sendAll("setAFK", { + name: this.name, + afk: afk + }); } User.prototype.autoAFK = function () { diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index ee64c7bb..f5ae5fc2 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -660,6 +660,24 @@ Callbacks = { }, + setAFK: function (data) { + var users = $("#userlist").children(); + for(var i = 0; i < users.length; i++) { + var name = users[i].children[1].innerHTML; + // Reformat user + if(name == data.name) { + var u = $(users[i]); + u.find(".icon-time").remove(); + $(users[i].children[1]).css("font-style", ""); + if(data.afk) { + $("").addClass("icon-time") + .appendTo(users[i].children[0]); + $(users[i].children[1]).css("font-style", ""); + } + } + } + }, + userLeave: function(data) { var users = $("#userlist").children(); for(var i = 0; i < users.length; i++) { From 229f8a206a4e3b64d9092bdbca987e675b11d2cb Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 1 Aug 2013 15:20:50 -0400 Subject: [PATCH 2/4] Fix rare case where paginator breaks --- www/assets/js/paginator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/assets/js/paginator.js b/www/assets/js/paginator.js index 3b862ed4..efaa6ad6 100644 --- a/www/assets/js/paginator.js +++ b/www/assets/js/paginator.js @@ -26,8 +26,8 @@ return; var ul = $("