diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/html/css/aurweb.css | 5 | ||||
-rw-r--r-- | web/html/packages.php | 35 | ||||
-rw-r--r-- | web/template/pkg_comments.php | 2 |
3 files changed, 36 insertions, 6 deletions
diff --git a/web/html/css/aurweb.css b/web/html/css/aurweb.css index f777ab83..f5e10371 100644 --- a/web/html/css/aurweb.css +++ b/web/html/css/aurweb.css @@ -148,8 +148,3 @@ label.confirmation, color: red; font-weight: bold; } - -#news div p { - max-height: 15em; - overflow: auto; -} diff --git a/web/html/packages.php b/web/html/packages.php index 113a1145..8d76c76d 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -72,10 +72,45 @@ function collapseDependsList(list) { }); } +function collapseComment(div) { + var linkid = div.attr('id') + 'link', + par = div.find('p'), + height = par.height(), + maxheight = 200; + + if (height <= maxheight) + return; + + par.css({ 'overflow': 'hidden', 'height': maxheight + 'px' }); + par.addClass('collapsed'); + par.after('<p><a id="' + linkid + '" href="#">Show More…</a></p>'); + + $('#' + linkid).click(function(event) { + var newheight; + + if (par.hasClass('collapsed')) { + par.css({ 'height': 'auto' }); + newheight = par.height(); + par.css({ 'height': maxheight }); + $(this).text('Collapse'); + } else { + newheight = maxheight; + $(this).text('Show More…'); + } + + par.animate({ 'height': newheight }); + par.toggleClass('collapsed'); + event.preventDefault(); + }); +} + $(document).ready(function() { collapseDependsList("#pkgdepslist"); collapseDependsList("#pkgreqslist"); collapseDependsList("#pkgsrcslist"); + $(".article-content").each(function() { + collapseComment($(this)); + }); }); </script> diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php index fee1898c..c23ec421 100644 --- a/web/template/pkg_comments.php +++ b/web/template/pkg_comments.php @@ -102,7 +102,7 @@ if (!isset($count)) { </form> <?php endif; ?> </h4> - <div class="article-content<?php if ($is_deleted): ?> comment-deleted<?php endif; ?>"> + <div id="<?= isset($pinned) ? "pinned-" : "comment-" ?><?= $row['ID'] ?>-content" class="article-content<?php if ($is_deleted): ?> comment-deleted<?php endif; ?>"> <p> <?= parse_comment($row['Comments']) ?> </p> |