summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsostler <sbostler@gmail.com>2010-01-13 01:49:13 -0500
committersostler <sbostler@gmail.com>2010-01-13 01:49:13 -0500
commitf2ee041478acb371cb5a7546e7efd2866f1abef1 (patch)
tree1e5dd92f0368a2cabedb3aedfccefb92f59c8332
parent15ea1479fb1bd1e7d79dd53b4597fe8a0aae30db (diff)
parent3b03a1d8207cdb17090686dd01734e305d9161f9 (diff)
Merge branch 'master' of ssh://dumpfmprod@dump.fm/home/dumpfmprod/prod
-rwxr-xr-xstatic/pichat.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/static/pichat.js b/static/pichat.js
index d51d18d..559e775 100755
--- a/static/pichat.js
+++ b/static/pichat.js
@@ -34,6 +34,13 @@ function buildMessageDiv(msg) {
+ buildMsgContent(msg.content) + '</div>';
}
+function buildGrowlDataAndPopDatShit(msg) {
+ var nick = escapeHtml(msg.nick);
+ nick = '<a href="/u/' + nick + ' " style="color:pink">' + nick + '</a>:'
+ var msg = buildMsgContent(msg.content)
+ growl(nick, msg)
+}
+
function buildUserDiv(user) {
if (user.avatar) {
return '<div class="username"><a href="/u/' + escapeHtml(user.nick) + '">' +
@@ -103,7 +110,10 @@ function delayedScrollToBottom(delay) {
}
function updateUI(msgs, users) {
- if (msgs !== null) {
+ if (window['growlize'] && msgs !== null) {
+ $.map(msgs, buildGrowlDataAndPopDatShit)
+ }
+ else if (msgs !== null) {
var msgStr = $.map(msgs, buildMessageDiv).join('');
var wasScrolledToBottom = isScrolledToBottom($('#messageList')[0]);
$('#messageList').append(msgStr);
@@ -223,3 +233,12 @@ function initLog() {
});
}
+
+function growl(user, msg) {
+ $.gritter.add({
+ // (string | mandatory) the heading of the notification
+ title: user,
+ // (string | mandatory) the text inside the notification
+ text: msg
+ });
+}