This commit is contained in:
calzoneman 2013-08-01 15:12:57 -04:00
parent 329505de9d
commit 8f72854e38
2 changed files with 24 additions and 2 deletions

View File

@ -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 () {

View File

@ -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) {
$("<i/>").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++) {