Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TF2R Emoticons edit
- // @version 1.2.7
- // @namespace http://www.tf2calculator.com
- // @include http://tf2r.com/*
- // @copyright 2013+, Hans, thanks to Iwasawafag for advice on regex and general help
- // ==/UserScript==
- $(function() {
- $('#rainDiv, .rainDrop').remove();
- var script = document.createElement('script');
- script.appendChild(document.createTextNode('(' + include + ')();'));
- document.head.appendChild(script);
- function include() {
- window.emoticonLoadFailed = function(image) {
- $(image).replaceWith($(image).attr('alt'));
- }
- var emoticon2 = function(message) {
- message = message.replace(/:[a-z0-9-_]+?:/ig, function(match) {
- 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 + '">';
- });
- return message;
- };
- setTimeout(function() {
- var originalAddMess = AddMess;
- AddMess = function(msg) {
- msg.message = emoticon2(msg.message);
- originalAddMess(msg);
- };
- }, 200);
- $('.ufmes').each(function() {
- $(this).html(emoticon2($(this).html()));
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement