![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
This is a theme layer modification that stops comment indenting after reaching a certain comment depth. You can also customize how much each comment will indent from its parent comment.
In this example, the comments will stop indenting after reaching a comment depth of 16.
Here, comments will indent 16px from the parent comment. The default indentation is 25px.
This is based on a theme mod from LJ that I really liked and tried to apply it to DW. The original also linked the comments, but I'm not sure how to do that here. If you have any questions, let me know. I'll try my best answering them.
function EntryPage::print_comments (Comment[] cs) {
#This is where you set the max comment depth that you want.
#After this comments will have the same depth as the parent comment.
var int no_indent_depth = 16;
#This is where you set how much each comment will indent in pixels.
#No need to add any units. Just the number.
var int no_indent_pixels = 16;
if (size $cs == 0) { return; }
foreach var Comment c ($cs) {
var string parity = $c.depth % 2 ? "odd" : "even";
var int indent = ($c.depth - 1) * $no_indent_pixels;
if ($c.depth >= $no_indent_depth) {
$indent = $no_indent_depth * $no_indent_pixels;
}
"<div class='comment-thread comment-depth-$parity comment-depth-$c.depth'>\n";
"<div id='$c.dom_id' style='margin-left: ${indent}px; margin-top: 5px'>\n";
if ($c.full) {
$this->print_comment($c);
} else {
$this->print_comment_partial($c);
}
"</div>";
$this->print_comments($c.replies);
"</div>";
}
}
var int no_indent_depth = 16;
In this example, the comments will stop indenting after reaching a comment depth of 16.
var int no_indent_pixels = 16;
Here, comments will indent 16px from the parent comment. The default indentation is 25px.
This is based on a theme mod from LJ that I really liked and tried to apply it to DW. The original also linked the comments, but I'm not sure how to do that here. If you have any questions, let me know. I'll try my best answering them.
Tags:
no subject
Date: 2009-09-12 01:29 pm (UTC)no subject
Date: 2009-09-12 06:17 pm (UTC)http://wiki.dwscoalition.org/notes/S2_How_Tos
no subject
Date: 2009-09-12 10:13 pm (UTC)no subject
Date: 2009-09-12 08:03 pm (UTC)no subject
Date: 2009-09-12 10:26 pm (UTC)|Parent Comment
¦
¦
‾ ‾ ‾ |Child Comment
¦ ¦
¦ ¦
¦ ‾ ‾ ‾ |Child Comment
¦
¦
‾ ‾ ‾ |Child Comment
¦
¦
‾ ‾ ‾ |Child Comment
It just made it easier visually to see how the comments were linked.