[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.

Date: 2009-09-12 01:29 pm (UTC)
turlough: purple crocuses ((mcr) bob approves)
From: [personal profile] turlough
*bookmarks for the time (hopefully not TOO distant) when I'll make my migrated FS layout DW compatible*

Date: 2009-09-12 06:17 pm (UTC)
foxfirefey: A firework bursts over the Las Vegas night skyline. (yay)
From: [personal profile] foxfirefey
Nifty--I've made a new wiki page to add how-tos like this to:

http://wiki.dwscoalition.org/notes/S2_How_Tos

Date: 2009-09-12 08:03 pm (UTC)
av8rmike: Neo from Matrix, text: I know S2 (I know s2)
From: [personal profile] av8rmike
Linked the comments to what?

Profile

Dreamwidth style system discussion

April 2025

S M T W T F S
  12345
6 78910 1112
13 141516171819
2021 2223242526
27282930   

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 31st, 2025 01:58 am
Powered by Dreamwidth Studios