[personal profile] mmmag posting in [community profile] style_system
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.

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.

Profile

Dreamwidth style system discussion

October 2025

S M T W T F S
   1 234
567891011
12131415161718
19202122232425
262728293031 

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 5th, 2025 03:11 pm
Powered by Dreamwidth Studios