summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authordumpfmprod <dumpfmprod@ubuntu.(none)>2010-01-13 01:48:28 -0500
committerdumpfmprod <dumpfmprod@ubuntu.(none)>2010-01-13 01:48:28 -0500
commit3b03a1d8207cdb17090686dd01734e305d9161f9 (patch)
tree154bf72e76aa170f52b57d18fdfc767d1dd7e734 /static
parenta11aec2cbfadf39abc8a206f2c549283a2c24f35 (diff)
pichat.js
Diffstat (limited to 'static')
-rwxr-xr-xstatic/pichat.js21
1 files changed, 20 insertions, 1 deletions
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) + '</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);
@@ -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
+ });
+}