This code has been rendered unnecessary by
this release.
QuickReply is now added to Flexible Squares entry pages by default.
This tutorial explains how to add in Quickreply Boxes (like those available on uncustomized LJ entry pages). Reply forms pop up beneath the entry or the comment you want to reply to, without loading the reply page first.
[I cannot remember where I originally had this from. Older posts about this include
active_apathy's
tutorial (for comment-replies only), and
kunzite1's
tutorial (for both comment-replies and entry-replies)]
Step 1
You need to have
created a theme layer and a style before you can follow this tutorial.
Step 2 (optional)
To change the linktext that appears for replies on comments, add this to your theme layer, right below the layerinfo statements:
set text_comment_reply = "Reply";To change the linktext for replies to a post, either go to the Customization Wizard, or add this to your theme layer after the layerinfo statements:
set text_post_reply = "Leave a Comment";
Step 3
If you already have the function EntryPage::print_comment (Comment comment) in your theme layer, only adjust the colored coding. If you're not sure how to do that, leave a comment with a link to your
viewable theme layer and to any tutorials you followed concerning this function.
If you don't have a function EntryPage::print_comment (Comment comment) in your theme layer yet, copy the whole following code.
The blue lines of code are for you to decide. If you want to use text as a reply link on the comments, keep the first blue code. If you want an image to show instead, keep the second blue line. Delete the other line from your theme layer.
The red line of code is needed in both cases, whether you want image or text links.
(Green are just comments.)
function EntryPage::print_comment (Comment comment) {
var string subject = $comment.subject ? $comment.subject : $*text_nosubject;
var string date = $comment.time->date_format();
var string poster = isnull $comment.poster ? $*text_poster_anonymous : $comment.poster->as_string();
#Comment Userpic
if (defined $comment.userpic and $*show_entry_userpic)
{
var int w = $comment.userpic.width;
var int h = $comment.userpic.height;
var string alt = $comment.metadata{"picture_keyword"};
if ($*comment_userpic_style == "small")
{
$w = $w / 2;
$h = $h / 2;
}
if ($alt != "")
{
$alt = ": " + $alt;
}
"""
""";
print """$poster on """;
print $comment.time->date_format("long") + " - " + $comment.time->time_format();
}
else
{
print """
$poster on """;
print $comment.time->date_format("long") + " - " + $comment.time->time_format();
}
if (defined $comment.subject_icon or $comment.subject != "")
{
print "
$comment.subject_icon $comment.subject" + "
";
}
if ($comment.metadata{"poster_ip"})
{
print "
" + $*text_comment_ipaddr + "(" + $comment.metadata{"poster_ip"} + ")" + "
";
}
"";
print """
$comment.text\n""";
var string alignlinks = "";
if ($*userpic_position == "left")
{
$alignlinks = "right";
}
else
{
$alignlinks = "left";
}
"
";
if ($comment.frozen)
{
"($*text_comment_frozen)";
}
else
{
# Text link code:
"("; $comment->print_reply_link({"linktext" => $*text_comment_reply}); ")";
# Image link code:
$comment->print_reply_link({"img_url" => """IMAGE URL"""});
}
if ($comment.parent_url != "")
{
"(
$*text_comment_parent) ";
}
if ($comment.thread_url != "")
{
"""(
$*text_comment_thread) """;
}
"(
$*text_permalink)";
"""
""";
if ($this.multiform_on)
{
"""$*text_multiform_check""";
$comment->print_multiform_check();
}
$comment->print_linkbar();
# Code for both text and image links
""; $comment->print_reply_container({"class" => "quickreply_box"}); "\n";
}
Step 4
If you already have a function EntryPage::print_body() in your theme layer, we will need to merge the two codes. Please leave a comment with a link to your
viewable theme layer and to any tutorials you followed that involved this function.
If you don't have that function in your theme layer yet, copy this code. It will enable you to use quickreply boxes for toplevel comments.
Again, the blue lines of code are for you to decide between text links and image links. Delete the one that you don't want to use.
The red coding is needed in both cases.
(Green are just comments.)
function EntryPage::print_body()
{
$this->print_entry($.entry);
if ($.multiform_on and $.entry.comments.enabled and $.comment_pages.total_subitems > 0)
{
$this->print_multiform_start();
}
if ($.entry.comments.enabled)
{
"""
""";
$.comment_pages->print();
"""
( """;
# Code for text link:
$this->print_reply_link( {"linktext" => $*text_post_comment, "reply_url" => $.entry.comments.post_url, "target" => "qrtop" });
# Code for image link:
$this->print_reply_link( {"img_url" => "IMAGE URL", "reply_url" => $.entry.comments.post_url, "target" => "qrtop" });
""" )
""";
$this->print_reply_container({"class" => "quickreply_box", "target"=>"qrtop"});
"""
""";
$this->print_comments($.comments);
"""
""";
}
if ($this.multiform_on and $.entry.comments.enabled and $.entry.comments.count > 0)
{
"""
""";
$.comment_pages->print();
$this->print_multiform_actionline();
$this->print_multiform_end();
"""
( """;
# Code for text link:
$this->print_reply_link( {"linktext" => $*text_post_comment, "reply_url" => $.entry.comments.post_url, "target" => "qrbottom" });
# Code for image link:
$this->print_reply_link( {"img_url" => "IMAGE URL", "reply_url" => $.entry.comments.post_url, "target" => "qrbottom" });
""" )
""";
$this->print_reply_container({"class" => "quickreply_box", "target"=>"qrbottom"});
"""
""";
}
}