expand.js: fix post order when new posts appear between loading index and expanding
This commit is contained in:
parent
a28b5fc3a1
commit
e5bdf63692
@ -27,7 +27,8 @@ $(document).ready(function(){
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
var last_expanded = false;
|
var last_expanded = false;
|
||||||
$(data).find('div.post.reply').each(function() {
|
$(data).find('div.post.reply').each(function() {
|
||||||
if(thread.find('#' + $(this).attr('id')).length == 0) {
|
var post_in_doc = thread.find('#' + $(this).attr('id'));
|
||||||
|
if(post_in_doc.length == 0) {
|
||||||
if(last_expanded) {
|
if(last_expanded) {
|
||||||
$(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">');
|
$(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">');
|
||||||
} else {
|
} else {
|
||||||
@ -37,6 +38,9 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
$(document).trigger('new_post', this);
|
$(document).trigger('new_post', this);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
last_expanded = post_in_doc;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$('<span class="omitted"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
|
$('<span class="omitted"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
|
||||||
.insertAfter(thread.find('span.omitted').css('display', 'none'))
|
.insertAfter(thread.find('span.omitted').css('display', 'none'))
|
||||||
|
Loading…
Reference in New Issue
Block a user