diff options
author | Sarven Capadisli <csarven@status.net> | 2009-09-30 13:29:37 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-09-30 13:29:37 +0000 |
commit | a57783de0214f061eca3ab65880f573e8668de03 (patch) | |
tree | 6c1012eae9947c1a27c2224fea0808dd8b1797fb /plugins/Realtime | |
parent | d9e7118a33181407f0ee1a61c435ef001a736754 (diff) |
Timeout a little incase the notice item from XHR response is
not appended to the page.
Diffstat (limited to 'plugins/Realtime')
-rw-r--r-- | plugins/Realtime/realtimeupdate.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 3303d3a44..11e466325 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -30,19 +30,20 @@ RealtimeUpdate = { receive: function(data) { - id = data.id; - - // Don't add it if it already exists - // - if ($("#notice-"+id).length > 0) { - return; - } - - var noticeItem = RealtimeUpdate.makeNoticeItem(data); - $("#notices_primary .notices").prepend(noticeItem); - $("#notices_primary .notice:first").css({display:"none"}); - $("#notices_primary .notice:first").fadeIn(1000); - NoticeReply(); + setTimeout(function() { + id = data.id; + + // Don't add it if it already exists + if ($("#notice-"+id).length > 0) { + return; + } + + var noticeItem = RealtimeUpdate.makeNoticeItem(data); + $("#notices_primary .notices").prepend(noticeItem); + $("#notices_primary .notice:first").css({display:"none"}); + $("#notices_primary .notice:first").fadeIn(1000); + NoticeReply(); + }, 500); }, makeNoticeItem: function(data) |