Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.ajax({
  2.       url: "chat.php?action=chatheartbeat",
  3.       cache: false,
  4.       dataType: "json",
  5.       success: function(data) {
  6.  
  7.         $.each(data.items, function(i,item){
  8.             if (item)   { // fix strange ie bug
  9.  
  10.                 chatboxtitle = item.f;
  11.  
  12.                 if ($("#chatbox_"+chatboxtitle).length <= 0) {
  13.                     createChatBox(chatboxtitle);
  14.                 }
  15.                 if ($("#chatbox_"+chatboxtitle).css('display') == 'none') {
  16.                     $("#chatbox_"+chatboxtitle).css('display','block');
  17.                     restructureChatBoxes();
  18.                 }
  19.                
  20.                 if (item.s == 1) {
  21.                     item.f = username;
  22.                 }
  23.  
  24.                 if (item.s == 2) {
  25.                     $("#chatbox_"+chatboxtitle+" .chatboxcontent").append('<div class="chatboxmessage"><span class="chatboxinfo">'+item.m+'</span></div>');
  26.                 } else {
  27.                     newMessages[chatboxtitle] = true;
  28.                     newMessagesWin[chatboxtitle] = true;
  29.                     $("#chatbox_"+chatboxtitle+" .chatboxcontent").append('<div class="chatboxmessage"><span class="chatboxmessagefrom">'+item.f+':&nbsp;&nbsp;</span><span class="chatboxmessagecontent">'+$.parseHTML(item.m)+'</span></div>');
  30.                 }
  31.  
  32.                 $("#chatbox_"+chatboxtitle+" .chatboxcontent").scrollTop($("#chatbox_"+chatboxtitle+" .chatboxcontent")[0].scrollHeight);
  33.                 itemsfound += 1;
  34.             }
  35.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement