From 4be9aa6350430703383b9df26be2aa37ce840cdc Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 24 Apr 2017 18:10:16 +0200 Subject: Fix the comment collapse feature In commit 4abde89 (Use JavaScript to collapse long comments, 2017-04-19), support for collapsing/expanding long comments was added. This was broken by the recent Markdown support since comments no longer live inside a single HTML paragraph. Fix this by wrapping each comment in another div container. Signed-off-by: Lukas Fleischer --- web/html/packages.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'web/html/packages.php') diff --git a/web/html/packages.php b/web/html/packages.php index 8d76c76d..7d5b2075 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -74,32 +74,33 @@ function collapseDependsList(list) { function collapseComment(div) { var linkid = div.attr('id') + 'link', - par = div.find('p'), - height = par.height(), + inner = div.find('div'), + height = inner.height(), maxheight = 200; if (height <= maxheight) return; - par.css({ 'overflow': 'hidden', 'height': maxheight + 'px' }); - par.addClass('collapsed'); - par.after('

Show More…

'); + inner.css({ 'overflow': 'hidden', 'height': maxheight + 'px' }); + inner.addClass('collapsed'); + inner.after('

Show More…

'); $('#' + linkid).click(function(event) { + var inner = $(this).parent().parent().find('div'); var newheight; - if (par.hasClass('collapsed')) { - par.css({ 'height': 'auto' }); - newheight = par.height(); - par.css({ 'height': maxheight }); + if (inner.hasClass('collapsed')) { + inner.css({ 'height': 'auto' }); + newheight = inner.height(); + inner.css({ 'height': maxheight }); $(this).text('Collapse'); } else { newheight = maxheight; $(this).text('Show More…'); } - par.animate({ 'height': newheight }); - par.toggleClass('collapsed'); + inner.animate({ 'height': newheight }); + inner.toggleClass('collapsed'); event.preventDefault(); }); } -- cgit v1.2.3-24-g4f1b