Move chat callback to addChatMessage

This commit is contained in:
calzoneman 2013-04-15 20:28:01 -05:00
parent 4e2e349196
commit 6807d0b686
2 changed files with 22 additions and 11 deletions

View file

@ -132,17 +132,7 @@ function initCallbacks() {
});
socket.on("chatMsg", function(data) {
if(IGNORED.indexOf(data.username) != -1) {
return;
}
var div = formatChatMessage(data);
div.appendTo($("#messagebuffer"));
// Cap chatbox at most recent 100 messages
if($("#messagebuffer").children().length > 100) {
$($("#messagebuffer").children()[0]).remove();
}
if(SCROLLCHAT)
$("#messagebuffer").scrollTop($("#messagebuffer").prop("scrollHeight"));
addChatMessage(data);
});
socket.on("userlist", function(data) {