1
0
mirror of https://github.com/djohnlewis/stackdump synced 2025-12-06 07:53:28 +00:00

Excess comments (defaults to any over 3) are now hidden by default.

They can be shown by clicking on the 'show comments' link.
This commit is contained in:
Samuel Lai
2012-08-18 17:44:01 +10:00
parent 3d515f51b1
commit 827445105b
5 changed files with 71 additions and 33 deletions

View File

@@ -243,6 +243,7 @@ pre code {
.post-comments ul {
list-style: none;
margin-left: 0;
margin-bottom: 18px;
}
.post-comments li {
@@ -275,6 +276,10 @@ li .post-comment-metadata {
color: #999999;
}
.show-comments {
display: none;
}
.user-card {
background-color: #F2F2F2;
}

View File

@@ -0,0 +1,34 @@
/**
* Bits of JavaScript used on the question page in Stackdump,
* (https://bitbucket.org/samuel.lai/stackdump/).
*
* Requires jQuery.
*/
function hideExcessCommentsInit() {
// this function initialises the 'hiding excess comments' functionality.
// show the show-comments links and attach a click event handler to them
$('.show-comments').show();
$('.show-comments a').click(showHiddenComments);
// hide the all the hidden comments
$('.hidden-comment').hide();
}
function showHiddenComments() {
// once comments are show, they can't be hidden again
// get the relevant hidden comments
var comments = $(this).closest('.show-comments').siblings('ul').children('li.hidden-comment');
// show the comments
comments.show();
// hide the link
$(this).closest('.show-comments').hide();
return false;
}
$(document).ready(hideExcessCommentsInit);