- var noticeItem = RealtimeUpdate.makeNoticeItem(data);
- var noticeItemID = $(noticeItem).attr('id');
-
- var list = $("#notices_primary .notices:first")
- var prepend = true;
-
- var threaded = list.hasClass('threaded-notices');
- if (threaded && data.in_reply_to_status_id) {
- // aho!
- var parent = $('#notice-' + data.in_reply_to_status_id);
- if (parent.length == 0) {
- // @todo fetch the original, insert it, and finish the rest
- } else {
- // Check the parent notice to make sure it's not a reply itself.
- // If so, use it's parent as the parent.
- var parentList = parent.closest('.notices');
- if (parentList.hasClass('threaded-replies')) {
- parent = parentList.closest('.notice');
- }
- list = parent.find('.threaded-replies');
- if (list.length == 0) {
- list = $('<ul class="notices threaded-replies xoxo"></ul>');
- parent.append(list);
+ RealtimeUpdate.makeNoticeItem(data, function(noticeItem) {
+ var noticeItemID = $(noticeItem).attr('id');
+
+ var list = $("#notices_primary .notices:first")
+ var prepend = true;
+
+ var threaded = list.hasClass('threaded-notices');
+ if (threaded && data.in_reply_to_status_id) {
+ // aho!
+ var parent = $('#notice-' + data.in_reply_to_status_id);
+ if (parent.length == 0) {
+ // @todo fetch the original, insert it, and finish the rest
+ } else {
+ // Check the parent notice to make sure it's not a reply itself.
+ // If so, use it's parent as the parent.
+ var parentList = parent.closest('.notices');
+ if (parentList.hasClass('threaded-replies')) {
+ parent = parentList.closest('.notice');
+ }
+ list = parent.find('.threaded-replies');
+ if (list.length == 0) {
+ list = $('<ul class="notices threaded-replies xoxo"></ul>');
+ parent.append(list);
+ }
+ prepend = false;