Skip to content

Instantly share code, notes, and snippets.

@yoksel
Created March 19, 2016 14:42
Show Gist options
  • Save yoksel/8d7fe2f97e4ddf46a8f0 to your computer and use it in GitHub Desktop.
Save yoksel/8d7fe2f97e4ddf46a8f0 to your computer and use it in GitHub Desktop.
EntryPage::print_comment()
function EntryPage::print_comment (Comment c) {
var Page p = get_page();
var string comment_class = "j-c";
var string c_id = "id=\"$c.dom_id\"";
if ($c.full) {
$comment_class = $comment_class + " j-c-full";
} else {
$comment_class = $comment_class + " j-c-partial";
}
if ($c.frozen) {
$comment_class = $comment_class + " j-p-c-frozen";
} elseif($c.screened) {
$comment_class = $comment_class + " j-p-c-screened";
}
"""<a name='$c.anchor'></a>\n""";
if ($p.showspam and $c.spam) {
"""<article $c_id class="$comment_class j-c-spam" style="margin-left: 0px;">\n""";
$this->print_comment_full($c);
"</article>\n";
} else {
var int indent = ($c.depth - 1) * 25;
"""<article $c_id class="$comment_class" style="margin-left: ${indent}px;">\n""";
if ($c.spam) {
if (size $c.replies > 0) {
"(SPAM)";
}
} elseif ($c.full) {
$this->print_comment_full($c);
} else {
$this->print_comment_partial($c);
}
"</article>\n";
}
if (not $c.frozen) {
$c->print_reply_container({"class" => "quickreply"});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment