We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 7dbb5fb8 authored by Evan Prodromou's avatar Evan Prodromou

Make notice auto-update

Shows notices auto-updating
parent ccf45d45
......@@ -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;
......@@ -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);
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>"+
"<p class=\"entry-content\">"+data['text']+"</p>"+
"<div class=\"entry-content\">"+
"<dl class=\"timestamp\">"+
"<a rel=\"bookmark\" href=\""+data['url']+"\" >"+
"<abbr class=\"published\" title=\""+data['created_at']+"\">a few seconds ago</abbr>"+
"</a> "+
"<dl class=\"device\">"+
"<dt>From</dt> "+
"<div class=\"notice-options\">"+
return ni;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment