From 3b03a1d8207cdb17090686dd01734e305d9161f9 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Wed, 13 Jan 2010 01:48:28 -0500 Subject: pichat.js --- static/pichat.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/static/pichat.js b/static/pichat.js index 8f61c9b..155fc80 100755 --- a/static/pichat.js +++ b/static/pichat.js @@ -34,6 +34,13 @@ function buildMessageDiv(msg) { + buildMsgContent(msg.content) + ''; } +function buildGrowlDataAndPopDatShit(msg) { + var nick = escapeHtml(msg.nick); + nick = '' + nick + ':' + var msg = buildMsgContent(msg.content) + growl(nick, msg) +} + function buildUserDiv(user) { if (user.avatar) { return '
' + @@ -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); @@ -220,3 +230,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 + }); +} -- cgit v1.2.3-70-g09d2