This commit is contained in:
calzoneman 2013-11-14 19:50:17 -06:00
parent f8e4a3fc34
commit 8eef96770f
3 changed files with 25 additions and 9 deletions

View File

@ -1,3 +1,7 @@
Thu Nov 14 19:49 2013 CDT
* www/assets/js/callbacks.js: Fix AFK users on join and profile
updates.
Wed Nov 13 22:35 2013 CDT Wed Nov 13 22:35 2013 CDT
* www/assets/js/util.js, www/assets/js/ui.js, * www/assets/js/util.js, www/assets/js/ui.js,
www/assets/js/callbacks.js, www/channel.html: www/assets/js/callbacks.js, www/channel.html:

View File

@ -682,12 +682,21 @@ Callbacks = {
div.data("leader", false); div.data("leader", false);
div.data("profile", data.profile); div.data("profile", data.profile);
div.data("icon", data.meta.icon); div.data("icon", data.meta.icon);
div.data("afk", data.meta.afk);
formatUserlistItem(div, data); formatUserlistItem(div, data);
addUserDropdown(div, data); addUserDropdown(div, data);
div.appendTo($("#userlist")); div.appendTo($("#userlist"));
sortUserlist(); sortUserlist();
}, },
setUserProfile: function (data) {
var user = findUserlistItem(data.name);
if (user === null)
return;
user.data("profile", data.profile);
formatUserlistItem(user);
},
setLeader: function (name) { setLeader: function (name) {
$(".userlist_item").each(function () { $(".userlist_item").each(function () {
$(this).find(".icon-star-empty").remove(); $(this).find(".icon-star-empty").remove();
@ -741,6 +750,13 @@ Callbacks = {
formatUserlistItem(user); formatUserlistItem(user);
}, },
/* DEPRECATED
SEE:
- setUserIcon
- setAFK
- setLeader
- setUserProfile
*/
updateUser: function(data) { updateUser: function(data) {
if(data.name == CLIENT.name) { if(data.name == CLIENT.name) {
CLIENT.leader = data.leader; CLIENT.leader = data.leader;
@ -774,13 +790,8 @@ Callbacks = {
var user = findUserlistItem(data.name); var user = findUserlistItem(data.name);
if(user === null) if(user === null)
return; return;
user.find(".icon-time").remove(); user.data("afk", data.afk);
$(user[0].children[1]).css("font-style", ""); formatUserlistItem(user);
if(data.afk) {
$("<i/>").addClass("icon-time")
.appendTo(user[0].children[0]);
$(user[0].children[1]).css("font-style", "italic");
}
if(USEROPTS.sort_afk) if(USEROPTS.sort_afk)
sortUserlist(); sortUserlist();
}, },

View File

@ -83,7 +83,8 @@ function formatUserlistItem(div) {
rank: div.data("rank"), rank: div.data("rank"),
profile: div.data("profile") || { image: "", text: ""}, profile: div.data("profile") || { image: "", text: ""},
leader: div.data("leader") || false, leader: div.data("leader") || false,
icon: div.data("icon") || false icon: div.data("icon") || false,
afk: div.data("afk") || false
}; };
var name = $(div.children()[1]); var name = $(div.children()[1]);
name.removeClass(); name.removeClass();
@ -122,7 +123,7 @@ function formatUserlistItem(div) {
if(data.leader) { if(data.leader) {
$("<i/>").addClass("icon-star-empty").appendTo(flair); $("<i/>").addClass("icon-star-empty").appendTo(flair);
} }
if(data.meta && data.meta.afk) { if(data.afk) {
name.css("font-style", "italic"); name.css("font-style", "italic");
$("<i/>").addClass("icon-time").appendTo(flair); $("<i/>").addClass("icon-time").appendTo(flair);
} }