diff options
| author | czaks <marcin@6irc.net> | 2013-07-26 22:39:00 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-07-26 22:39:00 -0400 |
| commit | e5bdf63692487e07833bbc4197ae7cd98e5af7e4 (patch) | |
| tree | 4720d38b40547d8c105dd5940b436ac60a8464ce | |
| parent | a28b5fc3a1975af863d348d3851b90b3c398baaf (diff) | |
expand.js: fix post order when new posts appear between loading index and expanding
| -rw-r--r-- | js/expand.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/js/expand.js b/js/expand.js index 1a719fad..a737ee7f 100644 --- a/js/expand.js +++ b/js/expand.js @@ -27,7 +27,8 @@ $(document).ready(function(){ success: function(data) { var last_expanded = false; $(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) { $(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">'); } else { @@ -37,6 +38,9 @@ $(document).ready(function(){ $(document).trigger('new_post', this); } + else { + last_expanded = post_in_doc; + } }); $('<span class="omitted"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>') .insertAfter(thread.find('span.omitted').css('display', 'none')) |
