diff --git a/ext/comment/main.php b/ext/comment/main.php
index 862ee8c2..09aa199b 100644
--- a/ext/comment/main.php
+++ b/ext/comment/main.php
@@ -50,6 +50,7 @@ class CommentList extends SimpleExtension {
$config->set_default_bool('comment_anon', true);
$config->set_default_int('comment_window', 5);
$config->set_default_int('comment_limit', 10);
+ $config->set_default_int('comment_list_count', 10);
$config->set_default_int('comment_count', 5);
if($config->get_int("ext_comments_version") < 2) {
@@ -187,6 +188,9 @@ class CommentList extends SimpleExtension {
$sb->add_label("
Show ");
$sb->add_int_option("comment_count");
$sb->add_label(" recent comments on the index");
+ $sb->add_label("
Show ");
+ $sb->add_int_option("comment_list_count");
+ $sb->add_label(" comments per image on the list");
$sb->add_text_option("comment_wordpress_key", "
Akismet Key ");
$event->panel->add_block($sb);
}
diff --git a/ext/comment/theme.php b/ext/comment/theme.php
index f54af86b..1799a5b7 100644
--- a/ext/comment/theme.php
+++ b/ext/comment/theme.php
@@ -2,13 +2,17 @@
class CommentListTheme extends Themelet {
/**
- * Do the basics of the comments page
- *
- * $page_number = the current page number
- * $total_pages = the total number of comment pages
+ * Display a page with a list of images, and for each image,
+ * the image's comments
*/
public function display_comment_list($images, $page_number, $total_pages, $can_post) {
- global $page;
+ global $config, $page;
+
+ // aaaaaaargh php
+ assert(is_array($images));
+ assert(is_int($page_number));
+ assert(is_int($total_pages));
+ assert(is_bool($can_post));
// parts for the whole page
$prev = $page_number - 1;
@@ -36,6 +40,13 @@ class CommentListTheme extends Themelet {
$thumb_html = $this->build_thumb_html($image);
$comment_html = "";
+ $comment_limit = $config->get_int("comment_list_count", 10);
+ $comment_count = count($comments);
+ if($comment_limit > 0 && $comment_count > $comment_limit) {
+ $hidden = $comment_count - $comment_limit;
+ $comment_html .= "
showing $comment_limit of $comment_count comments
"; + $comments = array_slice($comments, -$comment_limit); + } foreach($comments as $comment) { $comment_html .= $this->comment_to_html($comment); } diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php index 0bad0bed..c148ee76 100644 --- a/themes/danbooru/comment.theme.php +++ b/themes/danbooru/comment.theme.php @@ -2,7 +2,7 @@ class CustomCommentListTheme extends CommentListTheme { public function display_comment_list($images, $page_number, $total_pages, $can_post) { - global $page; + global $config, $page; $page->disable_left(); @@ -41,6 +41,13 @@ class CustomCommentListTheme extends CommentListTheme { $p = autodate($image->posted); $comment_html = "Date $p $s User $un"; + $comment_limit = $config->get_int("comment_list_count", 10); + $comment_count = count($comments); + if($comment_limit > 0 && $comment_count > $comment_limit) { + $hidden = $comment_count - $comment_limit; + $comment_html .= "
showing $comment_limit of $comment_count comments
"; + $comments = array_slice($comments, -$comment_limit); + } foreach($comments as $comment) { $comment_html .= $this->comment_to_html($comment); }