mirror of https://github.com/calzoneman/sync.git
Move chat callback to addChatMessage
This commit is contained in:
parent
4e2e349196
commit
6807d0b686
|
@ -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) {
|
||||
|
|
|
@ -155,6 +155,20 @@ function addUserDropdown(entry, name) {
|
|||
return ul;
|
||||
}
|
||||
|
||||
function addChatMessage(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"));
|
||||
}
|
||||
|
||||
function formatChatMessage(data) {
|
||||
var div = $("<div/>");
|
||||
if(uname) {
|
||||
|
@ -683,3 +697,10 @@ function onWindowFocus() {
|
|||
clearInterval(TITLE_BLINK);
|
||||
document.title = PAGETITLE;
|
||||
}
|
||||
|
||||
function enableBerrymotes() {
|
||||
$.getScript("./assets/js/berrymotes.js", function() {
|
||||
berryEmoteDataRefresh();
|
||||
monkeyPatchChat();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue