From 6bf217941a3342cdcf7768ab5269f7d35b050984 Mon Sep 17 00:00:00 2001 From: czaks Date: Fri, 26 Jul 2013 22:34:06 -0400 Subject: expand.js: fix a weird bug - thread expand not always worked due to post being loaded in DOM, but not put in a right place in a thread, or so, so check if it has been loaded in a thread instead of if it exists in DOM --- js/expand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/expand.js') diff --git a/js/expand.js b/js/expand.js index 05aece95..d0b4583c 100644 --- a/js/expand.js +++ b/js/expand.js @@ -27,7 +27,7 @@ $(document).ready(function(){ success: function(data) { var last_expanded = false; $(data).find('div.post.reply').each(function() { - if($('#' + $(this).attr('id')).length == 0) { + if(thread.find('#' + $(this).attr('id')).length == 0) { if(last_expanded) { $(this).addClass('expanded').insertAfter(last_expanded).before('
'); } else { -- cgit v1.3 From d82cd9b7bd03708f4940b4508acd0394713b8869 Mon Sep 17 00:00:00 2001 From: czaks Date: Fri, 26 Jul 2013 22:39:00 -0400 Subject: expand.js: fix post order when new posts appear between loading index and expanding --- js/expand.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js/expand.js') diff --git a/js/expand.js b/js/expand.js index d0b4583c..16a0efb2 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('
'); } else { @@ -36,6 +37,9 @@ $(document).ready(function(){ last_expanded = $(this); } + else { + last_expanded = post_in_doc; + } }); $('Hide expanded replies.') .insertAfter(thread.find('span.omitted').css('display', 'none')) -- cgit v1.3