somewhat updated danbooru comment theme
This commit is contained in:
parent
759ee2fe30
commit
a16b3db48c
@ -90,6 +90,20 @@ function to_shorthand_int($int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn a date into a time, a date, an "X minutes ago...", etc
|
||||||
|
*
|
||||||
|
* Currently missing step 2
|
||||||
|
*
|
||||||
|
* @retval string
|
||||||
|
*/
|
||||||
|
function autodate($date) {
|
||||||
|
$ts = strtotime($date);
|
||||||
|
// Step 2: ...
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||||
* HTML Generation *
|
* HTML Generation *
|
||||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
@ -126,7 +126,7 @@ class CommentList implements Extension {
|
|||||||
$page,
|
$page,
|
||||||
$this->get_comments($event->image->id),
|
$this->get_comments($event->image->id),
|
||||||
$this->can_comment(),
|
$this->can_comment(),
|
||||||
$event->image->id);
|
$event->image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($event instanceof ImageDeletionEvent) {
|
if($event instanceof ImageDeletionEvent) {
|
||||||
|
@ -26,17 +26,16 @@ class CustomCommentListTheme extends CommentListTheme {
|
|||||||
//$page->add_block(new Block("Comments", $html, "left"));
|
//$page->add_block(new Block("Comments", $html, "left"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_comments($page, $comments, $postbox, $image_id) {
|
public function display_comments(Page $page, $comments, $postbox, Image $image) {
|
||||||
$count = count($comments);
|
$count = count($comments);
|
||||||
|
$cs = $count == 1 ? "Comment" : "Comments";
|
||||||
if($postbox) {
|
if($postbox) {
|
||||||
$page->add_block(new Block("$count Comments",
|
$html = $this->comments_to_html($comments) . $this->build_postbox($image->id);
|
||||||
$this->comments_to_html($comments).
|
|
||||||
$this->build_postbox($image_id), "main", 30));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$page->add_block(new Block("$count Comments",
|
$html = $this->comments_to_html($comments);
|
||||||
$this->comments_to_html($comments), "main", 30));
|
|
||||||
}
|
}
|
||||||
|
$page->add_block(new Block("$count $cs", $html, "main", 30));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,19 +62,20 @@ class CustomCommentListTheme extends CommentListTheme {
|
|||||||
return "<p class='comment'>$h_userlink $h_dellink<br/><b>Posted on $h_posted</b><br/>$h_comment</p>";
|
return "<p class='comment'>$h_userlink $h_dellink<br/><b>Posted on $h_posted</b><br/>$h_comment</p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_comment_list($page, $image, $comments, $position, $with_postbox) {
|
public function add_comment_list(Page $page, Image $image, $comments, $position, $with_postbox) {
|
||||||
$count = count($comments);
|
$s = " ";
|
||||||
|
$un = $image->get_owner()->name;
|
||||||
|
$t = "";
|
||||||
|
foreach($image->get_tag_array() as $tag) {
|
||||||
|
$u_tag = url_escape($tag);
|
||||||
|
$t .= "<a href='".make_link("post/list/$u_tag/1")."'>".html_escape($tag)."</a> ";
|
||||||
|
}
|
||||||
|
$p = autodate($image->posted);
|
||||||
|
|
||||||
$html = "<div style='text-align: left'>";
|
$html = "<div style='text-align: left'>";
|
||||||
$html .= "<div style='float: left; margin-right: 16px;'>" . $this->build_thumb_html($image) . "</div>";
|
$html .= "<div style='float: left; margin-right: 16px;'>" . $this->build_thumb_html($image) . "</div>";
|
||||||
$html .= "<div style='float: right; margin-left: 16px; width: 200px; margin-bottom: 32px;'>";
|
|
||||||
foreach($image->get_tag_array() as $tag) {
|
|
||||||
$u_tag = url_escape($tag);
|
|
||||||
$html .= "<br><a href='".make_link("post/list/$u_tag/1")."'>".html_escape($tag)."</a>";
|
|
||||||
}
|
|
||||||
$html .= "</div>";
|
|
||||||
$html .= "<div style='margin-left: 250px;'>";
|
$html .= "<div style='margin-left: 250px;'>";
|
||||||
$html .= "<b>$count Comments</b><br>";
|
$html .= "<b>Date</b> $p $s <b>User</b> $un<br><b>Tags</b> $t<p> ";
|
||||||
$html .= $this->comments_to_html($comments);
|
$html .= $this->comments_to_html($comments);
|
||||||
$html .= "</div>";
|
$html .= "</div>";
|
||||||
$html .= "</div>";
|
$html .= "</div>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user