From 4d25ca85ce670e59806ea392855c6b3878519ee8 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 10 Aug 2014 20:55:37 +0200 Subject: live-index.js: initial commit --- js/expand.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'js/expand.js') diff --git a/js/expand.js b/js/expand.js index 0256aebe..0fa8de05 100644 --- a/js/expand.js +++ b/js/expand.js @@ -20,8 +20,8 @@ $(document).ready(function(){ var do_expand = function() { $(this) .html($(this).text().replace(_("Click reply to view."), ''+_("Click to expand")+'.')) - .find('a').click(function() { - var thread = $(this).parent().parent().parent(); + .find('a').click(window.expand_fun = function() { + var thread = $(this).parents('[id^="thread_"]'); var id = thread.attr('id').replace(/^thread_/, ''); $.ajax({ url: thread.find('p.intro a.post_no:first').attr('href'), @@ -43,12 +43,16 @@ $(document).ready(function(){ last_expanded = post_in_doc; } }); - $('' + _('Hide expanded replies') + '.') - .insertAfter(thread.find('span.omitted').css('display', 'none')) + + + thread.find("span.omitted").css('display', 'none'); + + $('' + _('Hide expanded replies') + '.') + .insertAfter(thread.find('.op div.body, .op span.omitted').last()) .click(function() { thread.find('.expanded').remove(); - $(this).prev().css('display', ''); - $(this).remove(); + $(this).parent().find(".omitted:not(.hide-expanded)").css('display', ''); + $(this).parent().find(".hide-expanded").remove(); }); } }); -- cgit v1.3