in particular, change color thingies on right of entries to actually like... link to stuff.
and show or not show links based on journal type. yay.
function Page::print_custom_head() {
# if recent/archive/friends/info/5th link/6th link/website, need 7th color
var Color gradient_7 = $*head_bgcolor->average($*page_bgcolor);
"""
""";
}
function Entry::print_linkbar() {
var string link_seperator = " $*comment_link_divider "; # 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) {
# 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) {
# 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 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 #
#################################################################################################################
$link_image{"nav_prev" } = "";
$link_image{"mem_add" } = "";
$link_image{"edit_entry" } = "";
$link_image{"edit_tags" } = "";
$link_image{"tell_friend"} = "";
$link_image{"nav_next" } = "";
$link_caption{"mem_add" } = $*text_memlink;
$link_caption{"edit_entry"} = $*text_editlink;
$link_caption{"edit_tags" } = $*text_edittagslink;
# 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());
# we're done! let's print it!
print $print;
}
function Page::lay_entrymeta (Entry e) {
var string subject = $e.subject !="" ? $e->plain_subject() : $*text_nosubject;
if (defined $e.userpic and (
$*show_entry_userpic
or ($e.poster.username != $.journal.username and $e.userpic.url != $.journal.default_pic.url)
or $.view == "friends"
or $.view == "entry")) {
"""
""";
}
"""
Title:
$subject """;
if ($e.tags) {
"""
$*text_tags:
""";
var int tcount = 0;
foreach var Tag t ($e.tags) {
$tcount++;
"""
$t.name""";
if ($tcount != size $e.tags) { ", "; }
}
"""
""";
}
if (($e.poster.username != $.journal.username) or $.view == "friends") {
"""
Author:
""";
if ($*lj_user_tags == false){
"""
$e.poster.username""";
} else {
"""$e.poster""";
}
if ($e.poster.username != $e.journal.username) {
""" posting in """;
if ($*lj_user_tags == false) {
"""
$e.journal.username""";
} else {
"""$e.journal""";
}
}
"""
""";
}
"""
Date:
"""; lay_historylink($e); """$*datedivider"""; print $e.time->time_format($*timeformat);"""
Security:
""";
if ($e.security != "") {
"""$e.security""";
if ($*security_icons == true) {
""" $e.security_icon""";
}
} else {
"""public""";
}
"""
""";
if (size $e.metadata{"music"}) {
"""
$*text_meta_music:
$e.metadata{"music"}
""";
}
if (size $e.metadata{"mood"}) {
"""
$*text_meta_mood:
$e.metadata{"mood"}""";
if ((defined $e.mood_icon) and ($*mood_icons == true)) {
""" $e.mood_icon """;
}
"""
""";
}
"""
""";
}
function Page::print_entry (Entry e){
var string{} view_url = { # make hash of urls
"recent" => get_url($e.journal, "recent"),
"friends" => get_url($e.journal, "friends"),
"archive" => get_url($e.journal, "archive"),
"userinfo" => get_url($e.journal, "userinfo"),
"tags" => get_url($e.journal, "recent") + "tag",
"userpics" => "$*SITEROOT/allpics.bml?user=$e.journal.username",
"memories" => "$*SITEROOT/tools/memories.bml?user=$e.journal.username",
"todo" => "$*SITEROOT/todo/?user=$e.journal.username",
"scrapbook" => $e.journal.journal_type == "P" ? "
http://pics.livejournal.com/$e.journal.username/" : "",
};
var string{} view_text = { # make hash of texts
"recent" => lang_viewname("recent"),
"friends" => $e.journal.journal_type != "C" ? lang_viewname("friends") : $*text_view_friends_comm,
"archive" => lang_viewname("archive"),
"userinfo" => $e.journal.journal_type != "C" ? lang_viewname("userinfo") : "Community Info",
"tags" => lang_viewname("tags"),
"userpics" => "User Pictures",
"memories" => "Memories",
"todo" => "To-Do List",
"scrapbook" => "ScrapBook",
};
var int width = 27;
var int height = 23;
"""
""";
var int count = 1;
var string[] views_order = $.views_order;
foreach var string v ($views_order) {
if($v != "" and $view_url{$v} != "") {
"""
""";
$count++;
}
}
"""
""";
$this->lay_entrymeta($e);
$e->print_text();
var bool show_poster_strip = not $e.poster->equals($e.journal);
if($show_poster_strip) {
"""
""";
$view_url = { # make hash of urls
"recent" => get_url($e.poster, "recent"),
"friends" => get_url($e.poster, "friends"),
"archive" => get_url($e.poster, "archive"),
"userinfo" => get_url($e.poster, "userinfo"),
"tags" => get_url($e.poster, "recent") + "tag",
"userpics" => "$*SITEROOT/allpics.bml?user=$e.poster.username",
"memories" => "$*SITEROOT/tools/memories.bml?user=$e.poster.username",
"todo" => "$*SITEROOT/todo/?user=$e.poster.username",
"scrapbook" => "http://pics.livejournal.com/$e.poster.username/",
};
$view_text = { # make hash of texts
"recent" => lang_viewname("recent"),
"friends" => lang_viewname("friends"),
"archive" => lang_viewname("archive"),
"userinfo" => lang_viewname("userinfo"),
"tags" => lang_viewname("tags"),
"userpics" => "User Pictures",
"memories" => "Memories",
"todo" => "To-Do List",
"scrapbook" => "ScrapBook",
};
var int width = 27;
var int height = 23;
"""
""";
var int count = 1;
var string[] views_order = $.views_order;
foreach var string v ($views_order) {
if($v != "" and $view_url{$v} != "") {
"""
""";
$count++;
}
}
"""
""";
}
"""
$*comment_link_divider """;
$e->print_linkbar();
$e.comments->print();
"""""";
if($show_poster_strip) {
"""
""";
}
lay_content_box_bottom();
}
function Comment::print_linkbar() {
var string link_seperator = " $*comment_link_divider ";
# 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 #
#####################################################################################################################################
# disable images
$link_image{"delete_comment" } = "";
$link_image{"freeze_thread" } = "";
$link_image{"unfreeze_thread" } = "";
$link_image{"screen_comment" } = "";
$link_image{"unscreen_comment"} = "";
$link_caption{"delete_comment" } = "Delete?";
$link_caption{"freeze_thread" } = "Not Frozen";
$link_caption{"unfreeze_thread" } = "Frozen";
$link_caption{"screen_comment" } = "Not Screened";
$link_caption{"unscreen_comment"} = "Screened";
# 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());
# we're done! let's print it!
print $print;
}
function EntryPage::lay_commentmeta (Comment c) {
var string subject = $c.subject !="" ? $c.subject : $*text_nosubject;
var string keywords = $c.metadata{"picture_keyword"} !="" ? $c.metadata{"picture_keyword"} : "(default)";
if (defined $c.userpic) {
"""
""";
}
"""
Title:
$subject""";
if (defined $c.subject_icon and ($*subject_icons == true)) {
""" $c.subject_icon""";
}
"""
Author:
""";
if (defined $c.poster) {
if ($*lj_user_tags == false) {
"""
$c.poster.username""";
} else {
"""$c.poster""";
}
} else {
"""$*text_poster_anonymous""";
}
"""
Date:
"""; print $c->time_display("$*dateformat$*datedivider", $*timeformat); """
Status:
""";
$c->print_linkbar();
"""
""";
if ($c.metadata{"poster_ip"}) {
"""
IP Address:
"""; print $c.metadata{"poster_ip"}; """
""";
}
"""
""";
}
function EntryPage::print_comment_partial (Comment c) {
if($c.depth == 1) {
var Comment[] replies;
$replies = $c.replies;
var int count = 0;
foreach var Comment reply ($replies) {
$count ++;
}
}
var string indent = ($c.depth - 1) * 15 + "px";
"""
""";
if($c.screened) {
"""Screened Comment""";
} else {
var string subject = $c.subject != "" ? $c.subject : $*text_nosubject;
"""
$subject by """;
if (defined $c.poster) {
var string base_url = $c.poster->base_url() + "/";
"""
$c.poster.username""";
} else {
"""$*text_poster_anonymous""";
}
}
"""""";
$this->print_comments($c.replies);
}
function Page::lay_print_header() {
var string k1Hheader_url = ""; # optional header url
var string k1Hheader_alt = ""; # optional header alt
var int k1Hheader_width = 0; # optional header width
var int k1Hheader_height = 0; # optional header height
if($k1Hheader_url != "") {
# if we've got dimensions set up above, let's put 'em together
var string k1Hheader_dims = "";
if($k1Hheader_width) {
$k1Hheader_dims = $k1Hheader_dims + " width=\"$k1Hheader_width\"";
}
if($k1Hheader_height) {
$k1Hheader_dims = $k1Hheader_dims + " height=\"$k1Hheader_height\"";
}
# print header image
"""
""";
}
var string block_size;
if ($*head_size == "small") {
$block_size = "50px";
} elseif ($*head_size == "medium") {
$block_size = "75px";
} else {
$block_size = "100px";
}
var string title = $this->title();
var string subtitle = $.global_subtitle;
var string display_title = $title;
# if($p.view == "entry") {
var string text = $display_title;
var string value = "";
var string{} changes = {"" => ""};
$changes{" - "} = "
";
foreach var string key ($changes) {
$value = $changes{$key};
if($value != "") {
# from lj:mageboltrat's industrial nippon (id=533012)
# see
http://www.livejournal.com/community/s2layers/11106.html var string[] findarray;
var int pos = 1;
foreach var string findcharacter($key) {
$findarray[$pos] = $findcharacter;
$pos = $pos + 1;
}
var int place = 1;
var bool found = false;
var string completedtext = "";
var string foundtext = "";
foreach var string searchcharacter($text) {
if ($searchcharacter == $findarray[$place]) {
if ($place == $key->length()) {
$foundtext = $value;
$place = 1;
} else {
$foundtext = $foundtext + $searchcharacter;
$place = $place + 1;
}
} else {
$completedtext = $completedtext + $foundtext + $searchcharacter;
$foundtext = "";
$place = 1;
}
}
$completedtext = $completedtext + $foundtext;
$text = $completedtext;
}
}
$display_title = $text;
# }
var string{} view_url = { # make hash of urls
"recent" => get_url($.journal, "recent"),
"friends" => get_url($.journal, "friends"),
"archive" => get_url($.journal, "archive"),
"userinfo" => get_url($.journal, "userinfo"),
"tags" => get_url($.journal, "recent") + "tag",
"userpics" => "$*SITEROOT/allpics.bml?user=$.journal.username",
"memories" => "$*SITEROOT/tools/memories.bml?user=$.journal.username",
"todo" => "$*SITEROOT/todo/?user=$.journal.username",
"update" => "$*SITEROOT/update.bml",
"website" => $.journal.website_url,
"scrapbook" => "
http://pics.livejournal.com/$.journal.username/",
};
var string{} view_text = { # make hash of texts
"recent" => lang_viewname("recent"),
"friends" => lang_viewname("friends"),
"archive" => lang_viewname("archive"),
"userinfo" => lang_viewname("userinfo"),
"tags" => lang_viewname("tags"),
"userpics" => "User Pictures",
"memories" => "Memories",
"todo" => "To-Do List",
"update" => "Update Journal",
"website" => $.journal.website_name != "" ? $.journal.website_name : $*text_website_default_name,
"scrapbook" => "ScrapBook",
};
# copy views order
var string[] views_order = $.views_order;
# add fifth block link
$views_order[size($views_order)] = $*fifth_block_link;
# add sixth block link, if != fifth block link
$views_order[size($views_order)] = $*sixth_block_link != $*fifth_block_link ? $*sixth_block_link : "";
# add website block link, if != fifth block link and != sixth block link
$views_order[size($views_order)] = ($*fifth_block_link != "website") and ($*sixth_block_link != "website") and $view_url{"website"} != "" ? "website" : "";
# create var for block id number
var int id_num = 1;
# open header
"""
""";
# are we showing the title?
if ($*show_title == true) {
# if we are, show title
"""
$display_title""";
# do we have a subtitle?
if($subtitle != "") {
# if we do, show it
"""
$subtitle""";
}
# close title
"""""";
}
# open view links table
"""
""";
# iterate thru each one
# increment block id number
foreach var string v ($views_order) {
if($view_url{$v} != "") {
"""
""";
$id_num++;
}
}
# close view links table
"""
""";
# close header
"""
""";
}