diff options
| author | sostler <sbostler@gmail.com> | 2010-01-13 01:49:13 -0500 |
|---|---|---|
| committer | sostler <sbostler@gmail.com> | 2010-01-13 01:49:13 -0500 |
| commit | f2ee041478acb371cb5a7546e7efd2866f1abef1 (patch) | |
| tree | 1e5dd92f0368a2cabedb3aedfccefb92f59c8332 | |
| parent | 15ea1479fb1bd1e7d79dd53b4597fe8a0aae30db (diff) | |
| parent | 3b03a1d8207cdb17090686dd01734e305d9161f9 (diff) | |
Merge branch 'master' of ssh://dumpfmprod@dump.fm/home/dumpfmprod/prod
| -rwxr-xr-x | static/pichat.js | 21 |
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 + }); +} |
