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:
parent
dfbbeb67c8
commit
5d6b9936c2
@ -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));
|
||||||
|
2
plugins/Realtime/realtimeupdate.min.js
vendored
2
plugins/Realtime/realtimeupdate.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user