-
-
Save qrush/820805 to your computer and use it in GitHub Desktop.
apply in: /Applications/Propane.app/Contents/Resources
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
diff --git a/enhancer.js b/enhancer.js | |
index 8cd9411..1ab7598 100644 | |
--- a/enhancer.js | |
+++ b/enhancer.js | |
@@ -58,9 +58,29 @@ if (window.propane) { | |
Campfire.PropaneResponder = Class.create({ | |
initialize: function(chat) { | |
+ var self = this | |
this.chat = chat; | |
+ | |
+ chat.transcript.element.childElements().each(function(elem){ | |
+ var msg = new Campfire.Message(chat, elem) | |
+ self.addGravatar(msg) | |
+ }) | |
+ | |
+ this.chat.layoutmanager.layout(); | |
+ this.chat.windowmanager.scrollToBottom(); | |
+ }, | |
+ addGravatar: function(message) { | |
+ if (message.actsLikeTextMessage()) { | |
+ var author = message.authorElement(); | |
+ | |
+ if (author.visible()) { | |
+ author.insert({after: '<img alt="'+message.author()+'" width="24" height="24" align="top" style="margin-left: 5px; border-radius:3px" src="http://ralphatar.heroku.com/?id='+this.authorID(message)+'&author='+message.author()+'">'}); | |
+ author.hide() | |
+ message.bodyCell.insert({top: '<strong>' + message.author() + '</strong>'}) | |
+ } | |
+ } | |
}, | |
- | |
+ | |
authorID: function(message) { | |
if (Element.hasClassName(message.element, 'you')) | |
return this.chat.userID; | |
@@ -116,6 +136,11 @@ if (window.propane) { | |
} | |
window.propane.messageInserted(message.id(), this.authorID(message), authorText, message.kind, body); | |
+ | |
+ this.addGravatar(message); | |
+ | |
+ if (this.chat.scrollToBottom) | |
+ this.chat.windowmanager.scrollToBottom(); | |
} | |
}, | |
hideEnterLeave: function() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment