ninetydegrees: Art & Text: heart with aroace colors, "you are loved" (0)
ninetydegrees (90d)☕ ([personal profile] ninetydegrees) wrote in [community profile] style_system 2012-08-19 03:19 pm (UTC)

Wow! This brings back memories!
Here's the code:

set entry_date_format = "short";
set lang_fmt_date_short = "%%mm%%/%%dd%%/%%yy%%";

function Entry::time_display(string datefmt, string timefmt) : string {
    var Page p = get_page();

var string day = $.time->date_format("%%day%%");

var string{} dayimage =
{
    "Monday" => "Monday.jpg",
    "Tuesday" => "Tuesday.jpg",
    "Wednesday" => "Wednesday.jpg",
    "Thursday" => "Thursday.jpg",
    "Friday" => "Friday.jpg",
    "Saturday" => "http://i1231.photobucket.com/albums/ee518/venbunny/Help/sat.gif",
    "Sunday" => "Sunday.jpg",
};

    var bool linkify = ( $p.view == "recent" or $p.view == "entry" or $p.view == "reply" or $p.view == "day" );

    if ($datefmt == "") { $datefmt = $*entry_date_format; }

    if ($timefmt == "") {

        if (viewer_logged_in()) {
            if (viewer_is_owner()) {
                $timefmt = $*entry_time_format;
            } else {
                if ($this.timeformat24) {
                    $timefmt = "short_24";
                } else {
                    $timefmt = "short";
                }
            }
        } else {
            $timefmt = $*entry_time_format;
        }

    } else {
        $timefmt = "short";
    }

    var string ret;
    if ($datefmt != "none") { $ret = $ret + """<span class="date"><img src="$dayimage{$day}" />""" + $this.time->date_format($datefmt, $linkify) + "</span>"; }
    if ($datefmt != "none" and $timefmt != "none") { $ret = $ret + " "; }
    if ($timefmt != "none") { $ret = $ret + """<span class="time">""" + $this.time->time_format($timefmt) + "</span>"; }

    if ($ret != "") { $ret = """<span class="datetime">$ret</span>"""; }

    return $ret;
}

All credit goes to kentucka from s2flexisquares over on LJ.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting