Paid Accounts Only
The following tutorial requires creating and editing a custom style, which in turn requires a paid, permanent, or early adopter account. Please read
What are the paid account benefits? and
How do I buy a paid account? to learn about the paid account benefits and how to buy a paid account.
This tutorial describes how you can change the wording of the 'Edit Entry', 'Edit Tags', 'Add to Memories', 'Share This!', 'Track', 'Untrack' and 'Flag' links in Opal (Libra OSWD). It will replace the function Page::print_entry (Entry e). This new code will be placed in a theme layer. If you already have a theme layer for this style, you can simply edit it. If not, you will need to create one by following the instructions in the
Theme Layer tutorial.
You will need to copy the function Page::print_entry (Entry e) to your theme layer. At the
Public Layers page, select
Opal (Libra OSWD). Click "Raw Source Code" when viewing a style to download the S2 source. Then locate and copy all of the Page::print_entry (Entry e) into the layer edit window for your theme layer. This function contains a lot of code to handle user icons, moods, and other formatting, and it will be like the following code:
function Page::print_entry (Entry e) {
print """""";
var string time = $e.time->time_format();
var string date = $e.time->date_format();
var string security;
if ($e.security != "") {
$security = """
""";
}
var UserLite name;
var string pname;
var bool show_name = ($.view == "friends" or $e.poster.username != $.journal.username or $.view == "entry") ? true : false;
var bool show_pic = (defined $e.userpic and ($.view == "friends" or $*show_entry_userpic or $e.poster.username != $e.journal.username or $.view == "entry")) ? true : false;
"""
""";
if($show_pic) {
"""
""";
}
if($show_name) {
$this->lay_make_username($e);
}
"""
$security $date $time
""";
$e.comments->print();
var Link link;
foreach var string key ($e.link_keyseq) {
$link = $e->get_link($key);
if (defined $link) {
"""
$link.caption """;
$link->print_raw();
}
}
"""
$*text_permalink $e.subject
""";
"
"; $e->print_text(); "
";
$e->print_metadata();
"""
back to top
""";
}
Within the function Page::print_entry (Entry e) locate the following block of code, which makes the various links:
var Link link;
foreach var string key ($e.link_keyseq) {
$link = $e->get_link($key);
if (defined $link) {
"""
$link.caption """;
$link->print_raw();
}
}
You will need to replace it with the following code, changing the words highlighted in orange to the words you wish to have for the links instead.
var string{} my_captions = {"edit_entry" => "Edit Entry",
"edit_tags" => "Edit Tags",
"mem_add" => "Add to Memories",
"tell_friend" => "Share This!",
"watch_comments" => "Track",
"unwatch_comments" => "Untrack",
"flag" => "Flag",};
var Link link;
foreach var string key ($e.link_keyseq) {
$link = $e->get_link($key);
if (defined $link) {
var string caption = defined $my_captions{$key} ? $my_captions{$key} : $link.caption;
"""
$caption """;
$link->print_raw();
}
}
Compile your layer, and it's ready to use. You will need to apply your theme layer via the
Customize interface in order for your changes to take effect.
Additional References
What are the different S2 layer types?
Written by
camomiletea.