Partial update of Realtime for threaded view; can now place replies into the proper subtimeline if it's already present, but not if it wasn't shown yet.

This commit is contained in:
Brion Vibber 2011-03-01 15:45:44 -08:00
parent dfbbeb67c8
commit 5d6b9936c2
2 changed files with 30 additions and 4 deletions

View File

@ -166,9 +166,35 @@ RealtimeUpdate = {
var noticeItem = RealtimeUpdate.makeNoticeItem(data); var noticeItem = RealtimeUpdate.makeNoticeItem(data);
var noticeItemID = $(noticeItem).attr('id'); var noticeItemID = $(noticeItem).attr('id');
$("#notices_primary .notices").prepend(noticeItem); var list = $("#notices_primary .notices:first")
$("#notices_primary .notice:first").css({display:"none"}); var prepend = true;
$("#notices_primary .notice:first").fadeIn(1000);
var threaded = true;
if (threaded && data.in_reply_to_status_id) {
// aho!
var parent = $('#notice-' + data.in_reply_to_status_id);
if (parent.length > 0) {
list = parent.find('.threaded-notices');
if (list.length == 0) {
list = $('<ul class="notices threaded-notices xoxo"></ul>');
parent.append(list);
}
prepend = false;
}
}
var newNotice = $(noticeItem);
if (prepend) {
list.prepend(newNotice);
} else {
var placeholder = list.find('li.notice-reply-placeholder')
if (placeholder) {
newNotice.insertBefore(placeholder)
} else {
newNotice.appendTo(list);
}
}
newNotice.css({display:"none"}).fadeIn(1000);
SN.U.NoticeReplyTo($('#'+noticeItemID)); SN.U.NoticeReplyTo($('#'+noticeItemID));
SN.U.NoticeWithAttachment($('#'+noticeItemID)); SN.U.NoticeWithAttachment($('#'+noticeItemID));

File diff suppressed because one or more lines are too long