Skip to content

Instantly share code, notes, and snippets.

@sprice
Created August 23, 2012 23:47
Show Gist options
  • Save sprice/3443673 to your computer and use it in GitHub Desktop.
Save sprice/3443673 to your computer and use it in GitHub Desktop.
Drupal.chatroom.addPreviousMessageToBoard = function(message) {
// Check for multiple chat windows
if ($.isArray(Drupal.settings.chatroom.chats)) {
for (var key in Drupal.settings.chatroom.chats) {
if (Drupal.settings.chatroom.chats[key].cid === message.cid) {
var chat = Drupal.settings.chatroom.chats[key];
}
}
}
else {
var chat = Drupal.settings.chatroom.chats[message.cid];
}
console.log(Drupal.settings.chatroom.chats);
chat.prevMsgId = message.cmid;
Drupal.settings.chatroom.chats[message.cid] = chat;
$('#chatroom-board-' + message.cid).prepend(message.msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment