Advertisement
mateon1

PlugEnchance.js

Jun 7th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. *Load BassPlug
  3. */
  4. (
  5.     function (){
  6.         var jsCode = document.createElement('script');
  7.         jsCode.setAttribute('id', 'BassPlugDev-js');
  8.         jsCode.setAttribute('src', 'https://raw.github.com/derpthebass/BassPlug/master/BassPlugDev.js');
  9.         document.body.appendChild(jsCode);
  10.     }()
  11. );
  12. /**
  13. * Override appendToChat() to send messages through Emoji
  14. * (Used closure-compiler to make this 1 line; used a Python script to escape doublequotes)
  15. */
  16. setTimeout("function appendToChat(message,from,color){style=\"\";if(color)style='style=\"color:'+color+';\"';if(from)div=$('<div class=\"chat-message\"><span class=\"chat-from\" '+style+\">\"+from+'</span><span class=\"chat-text\" '+style+\">: \"+Emoji.emojify(message)+\"</span></div>\")[0];else div=$('<div class=\"chat-message\"><span class=\"chat-text\" '+style+\" >\"+Emoji.emojify(message)+\"</span></div>\")[0];scroll=false;if($(\"#chat-messages\")[0].scrollHeight-$(\"#chat-messages\").scrollTop()==$(\"#chat-messages\").outerHeight())scroll=true;var curChatDiv=Popout?Popout.Chat.chatMessages:Chat.chatMessages;var s=curChatDiv.scrollTop()>curChatDiv[0].scrollHeight-curChatDiv.height()-20;curChatDiv.append(div);if(s)curChatDiv.scrollTop(curChatDiv[0].scrollHeight)};",2500);
  17.  
  18. function getTime(){
  19.     return Date().split(" ")[4];
  20. }
  21.  
  22. /**
  23. * Override Emoji to manipulate messages
  24. * Append time, etc.
  25. * MORE TO COME
  26. */
  27. Emoji.emojify = function (text){
  28.     normal=!1;
  29.     if ((text[0]+text[1])===": "){
  30.         normal=!0;
  31.     };
  32.     console.log(getTime()+": "+text)
  33.     return normal? text : " ("+getTime()+"): "+text;
  34. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement