Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TF2R Emoticons edit
  3. // @version 1.2.7
  4. // @namespace http://www.tf2calculator.com
  5. // @include http://tf2r.com/*
  6. // @copyright 2013+, Hans, thanks to Iwasawafag for advice on regex and general help
  7. // ==/UserScript==
  8. $(function() {
  9.  
  10. $('#rainDiv, .rainDrop').remove();
  11. var script = document.createElement('script');
  12. script.appendChild(document.createTextNode('(' + include + ')();'));
  13. document.head.appendChild(script);
  14.  
  15. function include() {
  16. window.emoticonLoadFailed = function(image) {
  17. $(image).replaceWith($(image).attr('alt'));
  18. }
  19. var emoticon2 = function(message) {
  20. message = message.replace(/:[a-z0-9-_]+?:/ig, function(match) {
  21. return img = '<img src="http://cdn.steamcommunity.com/economy/emoticon/' + match.substr(1, match.length - 2) + '" onerror="emoticonLoadFailed(this);" alt="' + match + '" style="margin-bottom:-5px;" title="' + match + '">';
  22. });
  23. return message;
  24. };
  25. setTimeout(function() {
  26. var originalAddMess = AddMess;
  27. AddMess = function(msg) {
  28. msg.message = emoticon2(msg.message);
  29. originalAddMess(msg);
  30. };
  31. }, 200);
  32. $('.ufmes').each(function() {
  33. $(this).html(emoticon2($(this).html()));
  34. });
  35. }
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement