(Un)documentation

S2 --

I don't believe S2's documentation has ever been updated. At this point it hasn't even been touched to note the introduction of five new keywords. I only noticed because I stumbled across this.

S2 now supports break and continue statements in foreach blocks (and only in foreach blocks):

foreach var int i ( 0 .. 10 ) {
    print $i;
    if ( $i < 6 ) {
        continue;
    }
    break;
}

The output is "123456".

It also now supports instanceof, isa and as operators. To quote Mart's patch:

isa checks to see if $obj is an instance of the given class or any of its subclasses. (Pronounced "is a".)

instanceof checks only for the named class, ignoring subclasses.

"as" is the typecast operator, which will do some runtime type checking and, if successful, return the object as a new static type. If the types are incompatible, "as" returns a null object.

Admin Console

Some regular user options can only be changed via the admin console (?!), but the quick reference only lists the ones that normal users don't have privs to touch. I couldn't even find all of them in the FAQ. This list may not be up to date, but lists hooks set in ljhooks.pl and ljcom.pl.

Usage: set [option_name] [option_value], e.g. set synlevel title.

Name Values Description
synlevel title, summary, full How much is shown in feeds?
newpost_minsecurity public, friends, private Entries get which security level by default?
stylesys s1, s2 Use which style system?
maximagesize 100x100, 40x40, 643x17 [...etc] Images larger than this size will be replaced by a placeholder.
opt_ljcut_disable_lastn 0, 1 Disable lj-cut on "last n entries" pages.
opt_ljcut_disable_friends 0, 1 Disable lj-cut on friends pages.
disable_quickreply 0, 1 Guess.
disable_nudge 0, 1 Disable the horrid "nudge" feature.
trusted_s1 Comma separated list of style ids to trust, e.g. "4,43,54,21" You can't use `customview.cgi` with untrusted styles.
latest_optout yes, no LiveJournal.com specific. Don't show posts in the global "latest posts" feed.
no_mail_alias 0, 1 LiveJournal.com specific. Disable `[username]@livejournal.com` mail alias.
opt_exclude_stats 0, 1 LiveJournal.com specific. Exclude from LiveJournal's anonymous statistics-gathering.
icbm valid coordinates Set ICBM coordinates for use by GeoURL etc.

set_handler

The set_handler S2 function is documented only as:

set_handler(string eventname, string[][] commands) : void

It provides a very limited JavaScript API for use with the AJAX comment deletion/freezing/screening controls. There are a few default handlers, and some of the system styles use them. An example call is this:

set_handler("screen_comment_#", [
    [ "style_bgcolor", "cmtbar#", "#000000", ],
    [ "style_color", "cmtbar#", "#FFFFFF", ],
]);

When the event "screen_comment_38738" is fired (i.e. when the user clicks the screen button on the comment with that id), the background colour of DOM object "cmtbar38738" will be changed to black and its foreground colour to white.

The allowed events are, as far as I know:

screen_comment_#
unscreen_comment_#
delete_comment_#
freeze_comment_#
unfreeze_comment_#

And the allowed commands:

style_bgcolor
style_color
set_class
set_image