?

Log in

No account? Create an account

Previous Entry | Next Entry

As requested here by zheida (and probably several other times), these functions will change the linkbars on entries to something like the "3 Column" style. You will have to find/make your own button images; however, LiveJournal does have a few default images that will be used if you don't supply your own. The default image size is 22px wide by 20px tall, but any size button could be used, conceivably. You will need images for:
Permalink, Reply, Replies Frozen, Parent, Thread, Edit, Delete, Freeze, Unfreeze, Track, Untrack, Screen, Unscreen, and Watching (images don't need to be unique).

To use, copy the two functions into your theme layer. (There is already lots of information in the FAQs and this community on making a layer.) Once you have uploaded your button images to ScrapBook, Photobucket, or wherever, replace the red text with your own URLs. To use text instead of an image, just change the URL to "".

# Replaces the first four links with images
function EntryPage::print_comment(Comment e) {
    var string{} link_images = { # Replace IMAGE_URL with the URL to your image
        "permalink"      => "http://IMAGE_URL",
        "comment_frozen" => "http://IMAGE_URL",
        "comment_reply"  => "http://IMAGE_URL",
        "comment_parent" => "http://IMAGE_URL",
        "comment_thread" => "http://IMAGE_URL",
    };

    var string barc = "comment-" + ($e.depth % 2 ? "odd" : "even");
    var string screenbarc = "";
    var string borderwidth = "";
    if ($e.screened) {
        $screenbarc = " border-width: 3px; border-style: dashed;";
    }
    var string indent = ($e.depth - 1) * 25 + "px;";
    var string id     = $e.dom_id ? " id=\"$e.dom_id\"" : "";

    if (not $e.full) {
        # Collapsed mode

        """
        <a name='$e.anchor'></a>
        <div $id style="margin-left: $indent">
          <div class="collapsed-comment comment-inner">
            <div class="comment-meta">""";

        var string subject = $e.subject != "" ? $e.subject : """<i class="nosubject">$*text_nosubject</i>""";

        print safe """<a href="$e.permalink_url" class="collapsed-comment-link">$subject</a> <span class="separator">-</span> """;

        var string poster = (defined $e.poster ? ""+$e.poster : """<i class="noposter">$*text_poster_anonymous</i>""");
        print safe """$poster <span class="separator">-</span> """;
        print lang_posted_by_date_and_time($e, false, true, true);

        var Link expand_link = $e->get_link("expand_comments");
        if ($e.thread_url != "" and defined $expand_link) {
            print " "; $e->print_expand_link({ "class" => "collapsed-comment-link" });
        }

        """
            </div>
          </div>
        </div>\n""";

        if (size($e.replies) > 0) {
            foreach var Comment c ($e.replies) {
                $this->print_comment($c);
            }
        }


        return;
    }

    """<a name='$e.anchor'></a>
       <div $id style="margin-left: $indent$screenbarc">
       <div class="comment-inner $barc comment">
       <div class="comment-meta">""";

    if ($*opt_userpic_comments and defined $e.userpic) {
        """<div class="user-icon">$e.userpic</div>""";
    }

    var string poster = defined $e.poster ? $e.poster->as_string() : "<i>$*text_poster_anonymous</i>";

    print safe """<span class="commenter-name">$poster """;
    if ($e.metadata{"poster_ip"} != "") {
        "(" + $e.metadata{"poster_ip"} + ") ";
    }
    """wrote:</span><br />""";
    var string datetime = lang_posted_by_date_and_time($e, true, true, true);
    """<div class="comment-date"><abbr class="datetime">$datetime</abbr></div>""";

    if (defined $e.subject_icon) {
        """<div class="comment-subject-icon">$e.subject_icon</div>""";
    }

    if ($e.subject != "") {
        """<div class="comment-subject">$e.subject</div>""";
    }

    """<div class="comment-body">""";
    $e->print_text();
    """</div>

    <div class="comment-links">""";
    var string sep = """<span class="separator">|</span>""";
    var string img_link = """<img src="$link_images{"permalink"}" alt="$*text_permalink" title="$*text_permalink" />""";
    """<a class="permalink" href="$e.permalink_url">$img_link</a>""";
	
    if ($e.frozen) {
        $img_link = """<img src="$link_images{"comment_frozen"}" alt="$*text_comment_frozen" title="$*text_comment_frozen" />""";
        print safe " $sep $img_link";
    } else {
        " $sep "; $e->print_reply_link({"img_url" => "$link_images{"comment_reply"}"});
    }

    if ($e.parent_url) {
        $img_link = """<img src="$link_images{"comment_parent"}" alt="$*text_comment_parent" title="$*text_comment_parent" />""";
        print """ $sep <a href="$e.parent_url">$img_link</a>"""; 
	}
    if ($e.thread_url) {
        $img_link = """<img src="$link_images{"comment_thread"}" alt="$*text_comment_thread" title="$*text_comment_thread" />""";
        print """ $sep <a href="$e.thread_url">$img_link</a>""";
        var Link expand_link = $e->get_link("expand_comments");
        if (defined $expand_link) {
            " $sep " + $e->expand_link();
        }
    }

    $e->print_linkbar();

    if ($this.multiform_on) {
        println safe """ <label for="ljcomsel_$e.talkid">$*text_multiform_check</label>""";
        $e->print_multiform_check();
    }

    "</div>\n</div>\n</div>\n</div>\n";
    if (not $e.frozen) {
        $e->print_reply_container({"class" => "quickreply"});
    }

    if (size($e.replies) > 0) {
        foreach var Comment c ($e.replies) {
            $this->print_comment($c);
        }
    }
}

# Replaces the last four links with images
function Comment::print_linkbar() {
    var Link link;
    var string sep  = """<span class="separator">|</span>""";
    var string url  = "";
    var string text = "";
    var string img_url = "";

    var string{} link_caption = {
        "edit_comment"     => $*text_multiform_opt_edit,
        "delete_comment"   => $*text_multiform_opt_delete,
        "freeze_thread"    => $*text_multiform_opt_freeze,
        "unfreeze_thread"  => $*text_multiform_opt_unfreeze,
        "screen_comment"   => $*text_multiform_opt_screen,
        "unscreen_comment" => $*text_multiform_opt_unscreen,
        "watch_comments"   => $*text_multiform_opt_track,
        "unwatch_comments" => $*text_multiform_opt_untrack,
    };

    var string{} link_images = { # Replace IMAGE_URL with the URL to your image
        "edit_comment"     => "http://IMAGE_URL",
        "delete_comment"   => "http://IMAGE_URL",
        "freeze_thread"    => "http://IMAGE_URL",
        "unfreeze_thread"  => "http://IMAGE_URL",
        "screen_comment"   => "http://IMAGE_URL",
        "unscreen_comment" => "http://IMAGE_URL",
        "watch_thread"     => "http://IMAGE_URL",
        "unwatch_thread"   => "http://IMAGE_URL",
        "watching_parent"  => "http://IMAGE_URL",
    };
	
    foreach var string link_key ($.link_keyseq) {
        $link = $this->get_link($link_key);
        if (defined $link) {
            $url  = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            $img_url = $link_images{$link_key} != "" ? $link_images{$link_key} : $link.icon.url;
            print safe """ $sep <a href="$url"><img src="$img_url" alt="$text" title="$text"/></a>""";
        }
    }
}
Set your theme layer to be the active one from the Choose Journal Style page by clicking on "Your Custom Layers" in the left sidebar, then selecting "Apply Theme" under the appropriate layer.

Comments

( 1 comment — Leave a comment )
sbertie
Aug. 7th, 2008 04:50 pm (UTC)
thanks for this - if I do switch to expressive, it'll come in very handy!
( 1 comment — Leave a comment )

Latest Month

March 2016
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

S2 Help Communities

Tags

Powered by LiveJournal.com
Designed by chasethestars