summaryrefslogtreecommitdiff
path: root/plugins/Comet
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-26 15:37:00 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-26 15:37:00 -0400
commit7dbb5fb8fdf7c4f82c212863a17793a50f887f58 (patch)
treef22c787a7ec8093c240901c40714209a869557b5 /plugins/Comet
parentccf45d454c68f7f667d07e0db608569e049ec285 (diff)
Make notice auto-update
Shows notices auto-updating
Diffstat (limited to 'plugins/Comet')
-rw-r--r--plugins/Comet/CometPlugin.php5
-rw-r--r--plugins/Comet/updatetimeline.js37
2 files changed, 39 insertions, 3 deletions
diff --git a/plugins/Comet/CometPlugin.php b/plugins/Comet/CometPlugin.php
index f60d40075..a7a4f4b23 100644
--- a/plugins/Comet/CometPlugin.php
+++ b/plugins/Comet/CometPlugin.php
@@ -126,6 +126,11 @@ class CometPlugin extends Plugin
$act = new TwitterApiAction('/dev/null');
$arr = $act->twitter_status_array($notice, true);
+ $arr['url'] = $notice->bestUrl();
+
+ $profile = $notice->getProfile();
+ $arr['user']['profile_url'] = $profile->profileurl;
+
return $arr;
}
diff --git a/plugins/Comet/updatetimeline.js b/plugins/Comet/updatetimeline.js
index 7b22445e3..c6eefb447 100644
--- a/plugins/Comet/updatetimeline.js
+++ b/plugins/Comet/updatetimeline.js
@@ -23,14 +23,45 @@ var updater = function()
function receive(message)
{
- alert("Received notice.");
var noticeItem = makeNoticeItem(message.data);
- var noticeList = $('ul.notices');
+ $("#notices_primary .notices").prepend(noticeItem, true);
+ $("#notices_primary .notice:first").css({display:"none"});
+ $("#notices_primary .notice:first").fadeIn(2500);
+ NoticeHover();
+ NoticeReply();
}
function makeNoticeItem(data)
{
- return '';
+ user = data['user'];
+ ni = "<li class=\"hentry notice\" id=\"notice-"+data['id']+"\">"+
+ "<div class=\"entry-title\">"+
+ "<span class=\"vcard author\">"+
+ "<a href=\""+user['profile_url']+"\" class=\"url\">"+
+ "<img src=\""+user['profile_image_url']+"\" class=\"avatar photo\" width=\"48\" height=\"48\" alt=\""+user['screen_name']+"\"/>"+
+ "<span class=\"nickname fn\">"+user['screen_name']+"</span>"+
+ "</a>"+
+ "</span>"+
+ "<p class=\"entry-content\">"+data['text']+"</p>"+
+ "</div>"+
+ "<div class=\"entry-content\">"+
+ "<dl class=\"timestamp\">"+
+ "<dt>Published</dt>"+
+ "<dd>"+
+ "<a rel=\"bookmark\" href=\""+data['url']+"\" >"+
+ "<abbr class=\"published\" title=\""+data['created_at']+"\">a few seconds ago</abbr>"+
+ "</a> "+
+ "</dd>"+
+ "</dl>"+
+ "<dl class=\"device\">"+
+ "<dt>From</dt> "+
+ "<dd>"+data['source']+"</dd>"+
+ "</dl>"+
+ "</div>"+
+ "<div class=\"notice-options\">"+
+ "</div>"+
+ "</li>";
+ return ni;
}
}();