i think i got all this crap figured out! go me!
comments.
screened: screened comment css class.
frozen: frozen comment css class.
watching: watching comment css class.
print_reply_container().
print_reply_link().
fuf_#: pattern of id handles for [un]freeze images, used in set_handler() in EntryPage::print_body().
sus_#: pattern of id handles for [un]screen images, used in set_handler() in EntryPage::print_body().
tut_#: pattern of id handles for [un]watch images, used in set_handler() in EntryPage::print_body().
cmtbar#: pattern of id handles for comments, used in set_handler() in EntryPage::print_body().
fuf_$.talkid: actual id handles for [un]freeze images
sus_$.talkid: actual id handles for [un]screen images
tut_$.talkid: actual id handles for [un]watch images
cmtbar$c.talkid: actual id handles for comments.
function Page::print_custom_head() {
"""
""";
}
function Entry::print_metadata() {
var string tags_header = "Current Tags";
var Link edit_tags = $this->get_link("edit_tags");
if ((size $.metadata > 0) or ((size $.tags > 0) and ($*tags_aware))){
var string currents = "";
$currents = $currents +
"""
""";
foreach var string k ($.metadata){
var string text = $k;
var string val = $.metadata{$k};
if ($k == "mood"){
$text = $*text_meta_mood;
}
elseif ($k == "music") {
$text = $*text_meta_music;
}
if ($k == "mood" and defined $.mood_icon){
var Image i = $.mood_icon;
$val = "
$val";
}
$currents = $currents + """
[
$text
|
$val
]
""";
}
if ((size $.tags > 0) and $*tags_aware) {
var int tcount = 0;
if($edit_tags.url != "") {
$tags_header = """
$tags_header""";
}
$currents = $currents +
"""
[
$tags_header
|
""";
foreach var Tag t ($.tags) {
$currents = $currents + """
$t.name""";
$tcount++;
if ($tcount != size $.tags) { $currents = $currents + ", "; }
}
$currents = $currents +
"""
]
""";
}
$currents = $currents + "
";
println "$currents";
}
}
function Entry::print_linkbar() {
var string link_seperator = " "; # seperator for links
# initialize array/hashes
var string[] link_keyseq = [""];
var string{} link_url = {"" => ""};
var string{} link_caption = {"" => ""};
var string{} link_image = {"" => ""};
var string print = ""; # var for printing
var Page p = get_page(); # page handle to determine interentry
var bool show_interentry = ($p.view == "entry" or $p.view == "reply"); # if entry/reply view, show interentry
var int keyseq_index = 0; # set index point for new link_keyseq array
if($show_interentry and $*show_entrynav_icons) {
# if show interentry, put previous entry link first
$link_keyseq[$keyseq_index++] = "nav_prev";
# get previous entry link information
var Link prev = $this->get_link("nav_prev");
$link_url{"nav_prev"} = $prev.url;
$link_caption{"nav_prev"} = $prev.caption;
$link_image{"nav_prev"} = $prev.icon.url;
# get next entry link information
var Link next = $this->get_link("nav_next");
$link_url{"nav_next"} = $next.url;
$link_caption{"nav_next"} = $next.caption;
$link_image{"nav_next"} = $next.icon.url;
# gather current linkbar
foreach var string link_key ($.link_keyseq) {
var Link link = $this->get_link($link_key);
$link_url{$link_key} = $link.url;
$link_caption{$link_key} = $link.caption;
$link_image{$link_key} = $link.icon.url;
$link_keyseq[$keyseq_index++] = $link_key; # add this to new link_keyseq array
}
# if show interentry, put next entry link last
$link_keyseq[$keyseq_index++] = "nav_next";
######################################################################################################################################
# by now, the above hashes should look something like: #
# #
# If interentry: #
# Previous Entry: #
# $link_url{"nav_prev"} =
http://www.livejournal.com/go.bml?journal=exampleusername&itemid=256&dir=prev #
# $link_caption{"nav_prev"} = Previous Entry #
# $link_image{"nav_prev"} =
http://stat.livejournal.com/img/btn_prev.gif #
# #
# Edit Entry: #
# $link_url{"edit_entry"} =
http://www.livejournal.com/editjournal.bml?journal=exampleusername&itemid=256 #
# $link_caption{"edit_entry"} = Edit Entry #
# $link_image{"edit_entry"} =
http://stat.livejournal.com/img/btn_edit.gif #
# #
# Edit Tags: #
# $link_url{"edit_tags"} =
http://www.livejournal.com/edittags.bml?journal=exampleusername&itemid=256 #
# $link_caption{"edit_tags"} = Edit Tags #
# $link_image{"edit_tags"} =
http://stat.livejournal.com/img/btn_edittags.gif #
# #
# Add to Memories: #
# $link_url{"mem_add"} =
http://www.livejournal.com/tools/memadd.bml?journal=exampleusername&itemid=256 #
# $link_caption{"mem_add"} = Add to Memories #
# $link_image{"mem_add"} =
http://stat.livejournal.com/img/btn_memories.gif #
# #
# If not watching: #
# Watch Comments: #
# $link_url{"watch_comments"} =
http://www.livejournal.com/manage/subscriptions/entry.bml?journal=exampleusername&ditemid=256 #
# $link_caption{"watch_comments"} = Track Comments #
# $link_image{"watch_comments"} =
http://stat.livejournal.com/img/btn_track.gif #
# #
# If watching: #
# Unwatch Comments: #
# $link_url{"unwatch_comments"} =
http://www.livejournal.com/manage/subscriptions/entry.bml?journal=exampleusername&ditemid=256 #
# $link_caption{"unwatch_comments"} = Untrack Comments #
# $link_image{"unwatch_comments"} =
http://stat.livejournal.com/img/btn_tracking.gif #
# #
# If interentry: #
# Next Entry: #
# $link_url{"nav_next"} =
http://www.livejournal.com/go.bml?journal=exampleusername&itemid=256&dir=next #
# $link_caption{"nav_next"} = Next Entry #
# $link_image{"nav_next"} =
http://stat.livejournal.com/img/btn_next.gif #
######################################################################################################################################
$print = $print + """
""";
# loop thru linkbar and add links to print var
foreach var string link_key ($link_keyseq) {
# if we can do performed action, url will be present
if($link_url{$link_key} != "") {
$print = $print + """
""";
# if image url available, use it
if($link_image{$link_key} != "") {
$print = $print + """
""";
} else {
# else, just use text
$print = $print + "$link_caption{$link_key}";
}
# add a seperator
$print = $print + "$link_seperator";
}
}
# hack off last seperator
$print = $print->substr(0, $print->length() - $link_seperator->length());
$print = $print + "";
# we're done! let's print it!
print $print;
}
}
function Page::print_entry (Entry e) {
var Color bgcolor = "#ffffff";
var Color fgcolor = "#000000";
if($this isa FriendsPage) {
var FriendsPage fp = $this as FriendsPage;
var Friend f = $fp.friends{$e.journal.username};
$bgcolor = $f.bgcolor;
$fgcolor = $f.fgcolor;
}
print_entry($this, $e, $bgcolor, $fgcolor, false);
}
function print_entry (Page p, Entry e, Color bgcolor, Color fgcolor, bool hide_text) {
var bool show_recent_userpics = true;
var bool show_friends_userpics = true;
var bool show_day_userpics = true;
var bool show_entry_userpics = true;
var bool show_reply_userpics = true;
var bool show_userpic = defined $e.userpic and
(
($p.view == "recent" and $show_recent_userpics) or
($p.view == "friends" and $show_friends_userpics) or
($p.view == "day" and $show_day_userpics) or
($p.view == "entry" and $show_entry_userpics) or
($p.view == "reply" and $show_reply_userpics)
);
var bool show_poster = ($p.view == "friends") or (not $e.poster->equals($e.journal));
var bool show_journal = ($p.view == "friends") and (not $e.poster->equals($e.journal));
var string subject = $e.subject != "" ? $e.subject : """$*text_nosubject""";
var string datetime = $e.time->date_format("med")+"|" + $e.time->time_format() + "";
"""
""";
if ($e.security != "") {
$subject = "$e.security_icon $subject";
}
"""$subject
[$datetime]
""";
$e->print_linkbar();
if ($show_userpic or $show_poster or $show_journal) {
"""
""";
if($show_userpic) {
print "$e.userpic
";
}
if($show_journal) {
var string journal_base = $e.journal->base_url();
"""
$e.journal.username""";
}
if($show_poster) {
var string poster_base = $e.poster->base_url();
"""
[
$e.poster.username]""";
}
}
"""
""";
if (not $hide_text) {
"""
""";
$e->print_metadata();
$e->print_text();
"""""";
}
# print_reply_container(string{} opts)
# html attributes for postform container
# target | only needed for EntryPage.post_url, must be same as print_reply_link() target
# | when doing so:
# | this must be the same as the print_reply_link() target,
# | otherwise:
# | uses talkid of comment
# | ends up being "ljqrt$target" in the end
# class | css class
$p->print_reply_container({"target" => "topcomment", "class" => "quickreply"});
"""
$*text_permalink """;
if ($p.view != "entry" and $p.view != "reply") {
"""
"""; $e.comments->print();
} elseif ($e.comments.enabled) {
# print_reply_link(string{} opts)
# html attributes for link/image
# reply_url | explicit reply link url
# linktext | reply link text (required if not using image)
# target | only needed for EntryPage.post_url link, must be same as print_reply_container() target
# class | css class
# img_url | image source url (required if not using text)
# img_width | image width
# img_height | image height
# img_border | image border
# alt | image alt
# title | image title
"""
"""; $p->print_reply_link({"linktext" => $*text_post_comment, "target" => "topcomment"});
} else {
"""
""";
}
"""
""";
} # print_entry(Page,Entry,Color,Color,bool)
function Comment::print_linkbar() {
var string link_seperator = " ";
# initialize array/hashes
var string[] link_keyseq = [""];
var string{} link_url = {"" => ""};
var string{} link_caption = {"" => ""};
var string{} link_image = {"" => ""};
var string print = ""; # var for printing
var int keyseq_index = 0; # set index point for new link_keyseq array
# gather current linkbar
foreach var string link_key ($.link_keyseq) {
var Link link = $this->get_link($link_key);
$link_url{$link_key} = $link.url;
$link_caption{$link_key} = $link.caption;
$link_image{$link_key} = $link.icon.url;
$link_keyseq[$keyseq_index++] = $link_key; # add this to new link_keyseq array
}
#########################################################################################################################################
# by now, the above hashes should look something like: #
# #
# Delete Comment: #
# $link_url{"delete_comment"} =
http://www.livejournal.com/delcomment.bml?journal=exampleusername&id=256 #
# $link_caption{"delete_comment"} = Delete #
# $link_image{"delete_comment"} =
http://stat.livejournal.com/img/btn_del.gif #
# #
# If not frozen: #
# Freeze Comment: #
# $link_url{"freeze_thread"} =
http://www.livejournal.com/talkscreen.bml?mode=freeze&journal=exampleusername&talkid=256 #
# $link_caption{"freeze_thread"} = Freeze #
# $link_image{"freeze_thread"} =
http://stat.livejournal.com/img/btn_freeze.gif #
# #
# If frozen: #
# Unfreeze Comment: #
# $link_url{"unfreeze_thread"} =
http://www.livejournal.com/talkscreen.bml?mode=unfreeze&journal=exampleusername&talkid=256 #
# $link_caption{"unfreeze_thread"} = Unfreeze #
# $link_image{"unfreeze_thread"} =
http://stat.livejournal.com/img/btn_unfreeze.gif #
# #
# If not screened: #
# Screen Comment: #
# $link_url{"screen_comment"} =
http://www.livejournal.com/talkscreen.bml?mode=screen&journal=exampleusername&talkid=256 #
# $link_caption{"screen_comment"} = Screen #
# $link_image{"screen_comment"} =
http://stat.livejournal.com/img/btn_scr.gif #
# #
# If screened: #
# Unscreen Comment: #
# $link_url{"unscreen_comment"} =
http://www.livejournal.com/talkscreen.bml?mode=unfreeze&journal=exampleusername&talkid=256 #
# $link_caption{"unscreen_comment"} = Unscreen #
# $link_image{"unscreen_comment"} =
http://stat.livejournal.com/img/btn_unscr.gif #
# #
# If not watching: #
# Watch Thread: #
# $link_url{"watch_thread"} =
http://www.livejournal.com/manage/subscriptions/comments.bml?journal=exampleusername&dtalkid=256 #
# $link_caption{"watch_thread"} = Track This #
# $link_image{"watch_thread"} =
http://stat.livejournal.com/img/btn_track.gif #
# #
# If watching: #
# Unwatch Thread: #
# $link_url{"unwatch_thread"} =
http://www.livejournal.com/manage/subscriptions/comments.bml?journal=exampleusername&dtalkid=256 #
# $link_caption{"unwatch_thread"} = Untrack This #
# $link_image{"unwatch_thread"} =
http://stat.livejournal.com/img/btn_tracking.gif #
#########################################################################################################################################
if(1) {
# replace images
$link_image{"delete_comment" } = "
http://stat.livejournal.com/palimg/boxer/delete.gif/ptffffff";
$link_image{"freeze_thread" } = "
http://stat.livejournal.com/palimg/boxer/freeze.gif/ptffffff";
$link_image{"unfreeze_thread" } = "
http://stat.livejournal.com/palimg/boxer/unfreeze.gif/ptaaaaff";
$link_image{"screen_comment" } = "
http://stat.livejournal.com/palimg/boxer/screen.gif/ptffffff";
$link_image{"unscreen_comment"} = "
http://stat.livejournal.com/palimg/boxer/unscreen.gif/ptffaaaa";
$link_image{"watch_thread" } = "
http://stat.livejournal.com/palimg/boxer/track.gif/ptffffff";
$link_image{"unwatch_thread" } = "
http://stat.livejournal.com/palimg/boxer/untrack.gif/ptffffff";
}
if(0) {
# disable images
$link_image{"delete_comment" } = "";
$link_image{"freeze_thread" } = "";
$link_image{"unfreeze_thread" } = "";
$link_image{"screen_comment" } = "";
$link_image{"unscreen_comment"} = "";
$link_image{"watch_thread" } = "";
$link_image{"unwatch_thread" } = "";
}
var string id = "";
# loop thru linkbar and add links to print var
foreach var string link_key ($link_keyseq) {
# if we can do performed action, url will be present
if($link_url{$link_key} != "") {
$id = "";
# if we're freezing, add freeze handle ("fuf_#", where '#' is the comment talkid) to image
if($link_key->contains("freeze")) {
$id = "fuf_$.talkid";
}
# if we're screening, add screen handle ("sus_#", where '#' is the comment talkid) to image
if($link_key->contains("screen")) {
$id = "sus_$.talkid";
}
# if we're tracking, add screen handle ("tut_#", where '#' is the comment talkid) to image
if($link_key->contains("watch")) {
$id = "tut_$.talkid";
}
if($id != "") {
$id = " id=\"$id\" name=\"$id\"";
}
$print = $print + """
""";
# if image url available, use it
if($link_image{$link_key} != "") {
$print = $print + """
""";
} else {
# else, just use text
$print = $print + "$link_caption{$link_key}";
}
# add a seperator
$print = $print + "$link_seperator";
}
}
# hack off last seperator
$print = $print->substr(0, $print->length() - $link_seperator->length());
# we're done! let's print it!
print $print;
}
function EntryPage::print_body () {
print_entry($this, $.entry, null Color, null Color, $.viewing_thread);
if ($.entry.comments.enabled and $.comment_pages.total_subitems > 0) {
$this->print_multiform_start();
"""
Comments:
""";
$.comment_pages->print();
# set_handler(string eventname, string[][] commands)
# handles
# screen_comment_#
# unscreen_comment_#
# freeze_comment_#
# unfreeze_comment_#
# watch_thread_#
# unwatch_thread_#
#
# properties for element
# style_bgcolor | background color, handle must be same as handle in EntryPage::print_comment()
# style_color | foreground color, handle must be same as handle in EntryPage::print_comment()
# set_class | css class, handle must be same as handle in EntryPage::print_comment()
# set_image | image source url, handle must be same as handle in Comment::print_linkbar()
if(0) {
# change bgcolor/fgcolor of screened comments
set_handler("screen_comment_#", [
[ "style_bgcolor", "cmtbar#", "$*comment_bar_screened_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_screened_fgcolor", ],
]);
set_handler("unscreen_comment_#", [
[ "style_bgcolor", "cmtbar#", "$*comment_bar_one_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_one_fgcolor", ],
]);
# change bgcolor/fgcolor of frozen comments
set_handler("freeze_comment_#", [
[ "style_bgcolor", "cmtbar#", "#aaaaff", ],
[ "style_color", "cmtbar#", "#000000", ],
]);
set_handler("unfreeze_comment_#", [
[ "style_bgcolor", "cmtbar#", "$*comment_bar_one_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_one_fgcolor", ],
]);
}
# change images of screened comments
if(0) {
set_handler("screen_comment_#", [
[ "set_image", "sus_#", "
http://stat.livejournal.com/palimg/boxer/unscreen.gif/ptffaaaa", ],
]);
set_handler("unscreen_comment_#", [
[ "set_image", "sus_#", "
http://stat.livejournal.com/palimg/boxer/screen.gif/ptffffff", ],
]);
# change images of frozen comments
set_handler("freeze_comment_#", [
[ "set_image", "fuf_#", "
http://stat.livejournal.com/palimg/boxer/unfreeze.gif/ptaaaaff", ],
]);
set_handler("unfreeze_comment_#", [
[ "set_image", "fuf_#", "
http://stat.livejournal.com/palimg/boxer/freeze.gif/ptffffff", ],
]);
# change images of watched comments
set_handler("watch_thread_#", [
[ "set_image", "tut_#", "
http://stat.livejournal.com/palimg/boxer/untrack.gif/ptaaffaa", ],
]);
set_handler("unwatch_thread_#", [
[ "set_image", "tut_#", "
http://stat.livejournal.com/palimg/boxer/track.gif/ptffffff", ],
]);
}
# change class of screened comments
if(0) {
set_handler("screen_comment_#", [
[ "set_class", "cmtbar#", "screened", ],
]);
set_handler("unscreen_comment_#", [
[ "set_class", "cmtbar#", "normal", ],
]);
# change class of frozen comments
set_handler("freeze_comment_#", [
[ "set_class", "cmtbar#", "frozen", ],
]);
set_handler("unfreeze_comment_#", [
[ "set_class", "cmtbar#", "normal", ],
]);
}
if(1) {
# change bgcolor/fgcolor and images and class of screened comments
set_handler("screen_comment_#", [
[ "set_class", "cmtbar#", "screened", ],
[ "set_image", "sus_#", "
http://stat.livejournal.com/palimg/boxer/unscreen.gif/ptffaaaa", ],
[ "style_bgcolor", "cmtbar#", "$*comment_bar_screened_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_screened_fgcolor", ],
]);
set_handler("unscreen_comment_#", [
[ "set_class", "cmtbar#", "normal", ],
[ "set_image", "sus_#", "
http://stat.livejournal.com/palimg/boxer/screen.gif/ptffffff", ],
[ "style_bgcolor", "cmtbar#", "$*comment_bar_one_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_one_fgcolor", ],
]);
# change bgcolor/fgcolor and images and class of frozen comments
set_handler("freeze_comment_#", [
[ "set_class", "cmtbar#", "frozen", ],
[ "set_image", "fuf_#", "
http://stat.livejournal.com/palimg/boxer/unfreeze.gif/ptaaaaff", ],
[ "style_bgcolor", "cmtbar#", "#aaaaff", ],
[ "style_color", "cmtbar#", "#000000", ],
]);
set_handler("unfreeze_comment_#", [
[ "set_class", "cmtbar#", "normal", ],
[ "set_image", "fuf_#", "
http://stat.livejournal.com/palimg/boxer/freeze.gif/ptffffff", ],
[ "style_bgcolor", "cmtbar#", "$*comment_bar_one_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_one_fgcolor", ],
]);
# change images of watched comments
set_handler("watch_thread_#", [
[ "set_image", "tut_#", "
http://stat.livejournal.com/palimg/boxer/untrack.gif/ptaaffaa", ],
]);
set_handler("unwatch_thread_#", [
[ "set_image", "tut_#", "
http://stat.livejournal.com/palimg/boxer/track.gif/ptffffff", ],
]);
}
$this->print_comments($.comments);
$.comment_pages->print();
"""
""";
if ($this.multiform_on) {
"""
$*text_multiform_des
""";
$this->print_multiform_actionline();
"""
""";
$this->print_multiform_end();
}
}
}
function EntryPage::print_comment (Comment c) {
var Color bgcolor = new Color;
var Color fgcolor = new Color;
if ($c.screened) {
$bgcolor = $*comment_bar_screened_bgcolor;
$fgcolor = $*comment_bar_screened_fgcolor;
} elseif ($c.depth % 2) {
$bgcolor = $*comment_bar_one_bgcolor;
$fgcolor = $*comment_bar_one_fgcolor;
} else {
$bgcolor = $*comment_bar_two_bgcolor;
$fgcolor = $*comment_bar_two_fgcolor;
}
var string class = "";
var string poster = defined $c.poster ? $c.poster->as_string() : "(Anonymous)";
var string alttext = "";
var string userpic_url = "";
var string time_display = $c->time_display();
var string ip = $c.metadata{"poster_ip"};
var bool have_subject = (defined $c.subject_icon or $c.subject != "");
var string subject = "";
var string reply_text = $*text_comment_reply;
var bool print_reply = true;
var string parent = $c.parent_url != "" ? """(
$*text_comment_parent) """ : "";
var string thread = $c.thread_url != "" ? """(
$*text_comment_thread) """ : "";
if($ip != "") {
$ip = "$*text_comment_ipaddr [$ip]
";
}
if($have_subject) {
if($c.subject != "") {
$subject = $c.subject;
}
if(defined $c.subject_icon) {
if($subject != "") {
$subject = " $subject";
}
$subject = "$c.subject_icon$subject";
}
$subject = """$subject
""";
}
if($c.frozen) {
$reply_text = $*text_comment_frozen;
$print_reply = false;
$class = "frozen";
}
if($c.screened) {
$class = "screened";
}
if($.entry.comments.maxcomments) {
$reply_text = $*text_max_comments;
$print_reply = false;
}
if($class != "") {
$class = " class=\"$class\"";
}
"""
cmtbar$c.talkid"$class style="background-color: $bgcolor; color: $fgcolor; margin-top: 10px; width: 100%;">
""";
if (defined $c.userpic and $*comment_userpic_style != "off") {
var int w = $c.userpic.width;
var int h = $c.userpic.height;
# WARNING: this will later be done by the system (it'll be a
# constructional property), so don't copy this hack into your
# layout layers or you'll be messed up later.
if ($*comment_userpic_style == "small") {
$w = $w / 2;
$h = $h / 2;
}
$alttext = $c.poster.name;
$userpic_url = "$*SITEROOT/allpics.bml?user=$c.poster.username";
if($c.metadata{"picture_keyword"} != "") {
var string picword = $c.metadata{"picture_keyword"};
$alttext = "$alttext: $picword";
}
"""
""";
}
"""
""";
### From, date, etc
"""
$*text_comment_from $poster
$*text_comment_date $time_display
$ip
$subject
""";
### Gadgets
"""
""";
if ($this.multiform_on) {
""" $*text_multiform_check""";
$c->print_multiform_check();
"
";
}
$c->print_linkbar();
### Permalink
"""
(
$*text_permalink)
$c.text
""";
if ($print_reply) {
# print_reply_link(string{} opts)
# html attributes for link/image
# reply_url | explicit reply link url
# linktext | reply link text (required if not using image)
# target | only needed for EntryPage.post_url link, must be same as print_reply_container() target
# class | css class
# img_url | image source url (required if not using text)
# img_width | image width
# img_height | image height
# img_border | image border
# alt | image alt
# title | image title
"("; $c->print_reply_link({"linktext" => $reply_text}); ")";
} else {
"$reply_text ";
}
"$parent$thread";
if ($print_reply) {
# print_reply_container(string{} opts)
# html attributes for postform container
# target | only needed for EntryPage.post_url, must be same as print_reply_link() target
# | when doing so:
# | this must be the same as the print_reply_link() target,
# | otherwise:
# | uses talkid of comment
# | ends up being "ljqrt$target" in the end
# class | css class
$c->print_reply_container({"class" => "quickreply"});
}
"";
}