Advertisement
Lux-Ferre

Better Mute

Jul 8th, 2015
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function refreshChat(data)
  2. {
  3.     var chatbox = document.getElementById("chat-area-div");
  4.     var output = data;
  5.  
  6.    
  7.     console.log(output);
  8.     var isTop20 = false;
  9.     if(output.startsWith("#"))
  10.     {
  11.         output = output.substring(1);
  12.         isTop20 = true;
  13.     }
  14.    
  15.     var chatSegment = "";
  16.     if(output.startsWith("!!!yell"))
  17.             chatSegment += "<span><span style='color:blue;'><span class='chat-tag-yell'>Server Message</span> " + output.substring(7) + "</span><br />";
  18.     else if(output.startsWith("!!!smitty"))
  19.             chatSegment += "<span><span style='color:#666600;'><span class='chat-tag-dev'>Dev</span> " + output.substring(3) + "</span><br />";
  20.     else if(output.startsWith("|zack") || output.startsWith("|luxferre"))
  21.         chatSegment += "<span><span style='color:#669999;'><span class='chat-tag-mod'>Mod</span> " + output.substring(1) + "</span><br />";
  22.     else if(output.startsWith("nexone12"))
  23.         chatSegment += "<span><span style='color:#669999;'><span class='chat-tag-mod'>Mod</span> " +  output + "</span><br />";
  24.     else if(output.startsWith("*"))
  25.     {
  26.         if(!isMuted(output.substring(1)))
  27.         chatSegment += "<span style='color:green;'><span class='chat-tag-contributor'>Contributor</span> " +  output.substring(1) + "</span><br />";
  28.     }
  29.     else if(output.startsWith("|"))
  30.     {
  31.         if(!isMuted(output.substring(1)))
  32.         chatSegment += "<span><img src='images/icons/donor-icon.gif' style='vertical-align: text-top;' width='20' height='20' alt='Donor'/> " +  output.substring(1) + "<br />";
  33.     }
  34.     else
  35.     {
  36.         if(!isMuted(output))
  37.             chatSegment += output + "<br />";
  38.     }
  39.    
  40.    
  41.     /*I changed from this part here*/
  42.    
  43.     if(isMuted(output.substring(1)) || isMuted(output))
  44.     {
  45.         var timeStamp = ""
  46.     }
  47.     else if(isTop20)
  48.     {
  49.         chatSegment = "<img title='Top 10 in hiscores' src='images/icons/stats.png' style='vertical-align: text-top;' width='20' height='20' alt='Top 10 in hiscores'/>" + chatSegment;
  50.         var timeStamp = timeFetch()
  51.         }
  52.     else
  53.     {
  54.         var timeStamp = timeFetch()
  55.     }
  56.    
  57.     totalTextDiv = chatbox.innerHTML + timeStamp + chatSegment;
  58.    
  59.     /*To this part here*/
  60.    
  61.     /*if(totalTextDiv.length > 8500)
  62.     {
  63.         totalTextDiv.substring(chatSegment.length,totalTextDiv.length)
  64.     }*/
  65.    
  66.     chatbox.innerHTML = totalTextDiv;
  67.  
  68.     if(isAutoScrolling)
  69.     $("#chat-area-div").animate({ scrollTop:  55555555 }, 'slow');
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement