Skip to content

OddMuse

Notes and bookmarks.

CSS/HTML

Page structure and CSS classes:

  • div.header
    • span.gotobar.bar (a.local)
    • h1
    • p.subtitle
    • img.logo
  • div.wrapper
    • the contents (and div.page, div.journal etc.)
  • div.sidebar
  • div.content.browse
  • div.wrapper.close (no contents)
  • div.footer
    • hr
    • span.gotobar.bar (a.local)
    • span.edit.bar (<br/> + a.edit, a.history, …)
    • span.time (<br/> + a.author)
    • form.search (<p> <input…> … </p>)
    • $FooterNote

This adds a new rule which will produce links with the evil target="_new" attribute. It understands

[new:URL]

and

[new:URL text]

The links will have the class newwindow (like outside for normal off-site links).

push(@MyRules, &newWindowLink);
sub newWindowLink
{

    # compare sub LinkRules in oddmuse.pl
    if ($BracketText && m/G([new:$FullUrlPatterns+([^]]+?)])/cog
    or m/G([new:$FullUrlPattern])/cog)
    {
    my ($url, $text) = ($2, $3);
    $url =~ /^($UrlProtocols)/;
    my $class = "url $1";      # get protocol (http, ftp, ...)
    $text = $url unless $text; # use url as link text if text empty
    $url = UnquoteHtml($url);  # quote special chars
    $class .= ' newwindow';    # add newwindow to class
    # output link
    my $link = $q->a({-href=>$url, -class=>$class, -target=>"_new"}, $text);
    #Clean($link); # ?!
    #return '';
    return $link;
    }
    return undef;
}

Div rule

Á la http://www.oddmuse.org/cgi-bin/wiki/div_foo. Allows div and span tags with class and style attributes.

push(@MyRules, &divRule);
sub divRule
{
    if (m/G&lt;((?:div|span)(?:s+(?:class|style)="[^"]+")+)&gt;/cgi
    or m!G&lt;(/(?:div|span))&gt;!cgi)
    {
    return CloseHtmlEnvironments() . '<' . UrlDecode($1) . '>';
    }
    return undef;
}

Note: This might produce invalid HTML for span tags. Alex (the Oddmuse wizard) suggests a different treatment for span tags here.

Comments in page source code

push(@MyRules, &commentRule);
$RuleOrder{&commentRule} = -100;
sub commentRule
{
    if (m/G^(%.*)$/cmog)
    {
    #return '<!-- ' . UnquoteHtml($1) . ' -->';
        return '';
    }
    return undef;
}

Don't show username / IP addresses to anonymous

*OldGetAuthorLink = *GetAuthorLink;
*GetAuthorLink = *NewGetAuthorLink;

sub NewGetAuthorLink
{
    if (UserIsAdmin())
    {
    return OldGetAuthorLink(@_);
    }
    else
    {
    return "<em>Chiefrocker</em>";
    }
}

Allow Edit to Anonymous for Certain Pages

*OldUserIsEditor = *UserIsEditor;
*UserIsEditor = *NewUserIsEditor;
sub NewUserIsEditor
{
    return 1 if $OpenPageName =~ m/^(test|meier|gugus)$/;
    OldUserIsEditor();
}

TODO

(merge with links above.. some day..)

created: 2008-03-08, updated: 2015-10-10