S2 Smooth Sailing - modify the comment bar

Jun 30, 2007 19:27

With the help of the following code you can modyfy the comment bar in Smooth Sailing so, that you either only have the comment and readlink, or comment, read, edit and edit tags



function Entry::print_linkbar() {

# part of the code is from the original smooth sailing code
# part of it is shamelessly stolen from kunzite1
# http://community.livejournal.com/s2layers/36131.html

var Page p = get_page();
var bool printqr = false;

"""

    """;
    if ($.comments.enabled) {
    if ($.itemid==int($*layout_guestbook_entryid)) {"""
  • $*text_post_comment_guestbook
  • """;
    }else{
    if ($.comments.count > 0 or $.comments.screened) {
    """
  • """; print get_plural_phrase($.comments.count,"text_read_comments");

    """
  • """;
    }
    $printqr = true;
    """
  • """; $p->print_reply_link({"linktext" => $*text_post_comment, "target" => "qr$.journal.username$.itemid",

    "reply_url" => $.comments.post_url}); """
  • """;
    }
    }

    ########################################################################
    #### if you only want the comment and read link remove everything ####
    #### that comes between this comment ####
    #### and the comment where I tell you to stop to delete ####
    ########################################################################

    # initialize array/hashes
    var string[] link_keyseq = [""];
    var string{} link_url = {"" => ""};
    var string{} link_caption = {"" => ""};

    var string print = ""; # var for printing
    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;

    # 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;

    }

    # 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_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";
    }

    # alter data here
    $link_keyseq = ["edit_entry", "edit_tags"];
    # change link order ["edit_entry", "edit_tags", "mem_add"]
    # $link_caption{"edit_entry"} = "edit entry";
    # change caption

    # 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 + """
  • """;

    $print = $print + "$link_caption{$link_key}";

    # add a seperator
    $print = $print + "
  • ";
    }
    }

    # we're done! let's print it!
    print $print;

    ##############################
    ### STOP to delete here!!! ###
    ##############################

    """

""";
if ($printqr) { $p->print_reply_container({"class" => "quickreply_entry", "target" => "qr$.journal.username$.itemid"}); }

}

smooth sailing, s2

Previous post Next post
Up