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 html = data['html'].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
39 ni = "<li class=\"hentry notice\" id=\"notice-"+data['id']+"\">"+
40 "<div class=\"entry-title\">"+
41 "<span class=\"vcard author\">"+
42 "<a href=\""+user['profile_url']+"\" class=\"url\">"+
43 "<img src=\""+user['profile_image_url']+"\" class=\"avatar photo\" width=\"48\" height=\"48\" alt=\""+user['screen_name']+"\"/>"+
44 "<span class=\"nickname fn\">"+user['screen_name']+"</span>"+
47 "<p class=\"entry-content\">"+html+"</p>"+
49 "<div class=\"entry-content\">"+
50 "<dl class=\"timestamp\">"+
53 "<a rel=\"bookmark\" href=\""+data['url']+"\" >"+
54 "<abbr class=\"published\" title=\""+data['created_at']+"\">a few seconds ago</abbr>"+
58 "<dl class=\"device\">"+
60 "<dd>"+data['source']+"</dd>"+
63 "<div class=\"notice-options\">"+