Last active
December 11, 2015 23:19
-
-
Save rlemon/4676005 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name MOUSTACHE CHAT | |
// @author Robert Lemon | |
// @version 0.1 | |
// @namespace http://rlemon.com | |
// @description Makes the chat all moustachy | |
// @include http://chat.stackexchange.com/rooms/* | |
// @include http://chat.stackoverflow.com/rooms/* | |
// ==/UserScript== | |
(function() { | |
var elm = document.createElement('script'); | |
elm.src = 'http://lemonmeme.com/moustache.js'; | |
document.body.appendChild(elm); | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************************************** | |
* http://lemonmeme.com/moustache.js * | |
***************************************/ | |
function gravatarUrl(a,e,f){ | |
return"!"==e.charAt(0)?(a=e.substr(1),imgurProfileImage.test(a)&&(e=/\?/.test(a)?"&":"?",a+=e+"g&s="+legalImgurSizeAtLeast(f)),a):"http://mustachify.me/?src=http://lemonmeme.com/moustache.php?img="+e; | |
} | |
function init() { | |
$('.avatar img').each(function() { | |
var tests = $(this).closest('.user-container').attr('class').match(/user-(\d+)/g); | |
if( tests ) { | |
var id = tests[0].split('-')[1]; | |
this.src = gravatarUrl(id,CHAT.user(id).email_hash,128) | |
} | |
}); | |
} | |
setTimeout(init, 1000); // funky bug if I don't wait for the chat to init. I'm too lazy to think of another alternative. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment