Skip to content

Instantly share code, notes, and snippets.

@phpfunk
Last active December 10, 2015 00:48
Show Gist options
  • Save phpfunk/4353486 to your computer and use it in GitHub Desktop.
Save phpfunk/4353486 to your computer and use it in GitHub Desktop.
A really simple userscript to replace the usernames with their current avatar in Campfire.
img.plain-avatar {
border-radius: 10px;
}
a.image img {
border-radius: 10px !important;
box-shadow: #808080 3px 3px 3px !important;
}
function add_avatars() {
$$('.author').each(
function(elem) {
var avatar = elem.dataset.avatar;
var nm = elem.dataset.name;
if (avatar !== undefined) {
elem.update('<img src="' + avatar + '" width="35" height="35" title="' + nm + '" class="plain-avatar" />');
}
});
}
add_avatars();
Campfire.Transcript.prototype.insertMessages_original_2 = Campfire.Transcript.prototype.insertMessages;
Campfire.Transcript.prototype.insertMessages = function() {
messages = this.insertMessages_original_2.apply(this, arguments);
add_avatars();
return messages;
};
@cdevroe
Copy link

cdevroe commented Dec 21, 2012

This will come in handy, thanks!

@cdevroe
Copy link

cdevroe commented Dec 21, 2012

The CSS didn't work for me. Not sure why.

@phpfunk
Copy link
Author

phpfunk commented Dec 21, 2012

hmmmm, I added it as another style and it seemed to work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment