Last active
December 10, 2015 00:48
-
-
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.
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
img.plain-avatar { | |
border-radius: 10px; | |
} | |
a.image img { | |
border-radius: 10px !important; | |
box-shadow: #808080 3px 3px 3px !important; | |
} |
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
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; | |
}; |
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
The CSS didn't work for me. Not sure why.