1 // update the local timeline from a Comet server
4 var updater = function()
9 init: function(server, timeline)
11 _cometd = $.cometd; // Uses the default Comet object
12 _cometd.setLogLevel('debug');
14 _cometd.subscribe(timeline, receive);
15 $(window).unload(leave);
24 function receive(message)
26 var noticeItem = makeNoticeItem(message.data);
27 $("#notices_primary .notices").prepend(noticeItem, true);
28 $("#notices_primary .notice:first").css({display:"none"});
29 $("#notices_primary .notice:first").fadeIn(2500);
34 function makeNoticeItem(data)
37 ni = "<li class=\"hentry notice\" id=\"notice-"+data['id']+"\">"+
38 "<div class=\"entry-title\">"+
39 "<span class=\"vcard author\">"+
40 "<a href=\""+user['profile_url']+"\" class=\"url\">"+
41 "<img src=\""+user['profile_image_url']+"\" class=\"avatar photo\" width=\"48\" height=\"48\" alt=\""+user['screen_name']+"\"/>"+
42 "<span class=\"nickname fn\">"+user['screen_name']+"</span>"+
45 "<p class=\"entry-content\">"+data['text']+"</p>"+
47 "<div class=\"entry-content\">"+
48 "<dl class=\"timestamp\">"+
51 "<a rel=\"bookmark\" href=\""+data['url']+"\" >"+
52 "<abbr class=\"published\" title=\""+data['created_at']+"\">a few seconds ago</abbr>"+
56 "<dl class=\"device\">"+
58 "<dd>"+data['source']+"</dd>"+
61 "<div class=\"notice-options\">"+