Minor menu cleanup + add "Projects home" link

This commit is contained in:
Yorhel 2012-05-04 16:26:11 +02:00
parent c661838551
commit e11c9d17e6
2 changed files with 22 additions and 13 deletions

View file

@ -368,7 +368,13 @@ sub genChanges {
sub htmlHeader { sub htmlHeader {
my $s = shift; my $s = shift;
my %o = (page => '', sec => '', sec2 => '', @_ ); my %o = (
spec => { map +($_,1), qw|ncdu ncdc tuwf| },
page => '',
sec => '',
sec2 => '',
@_
);
html; html;
head; head;
Link rel => 'stylesheet', href => '/style.css', type => 'text/css', media => 'all'; Link rel => 'stylesheet', href => '/style.css', type => 'text/css', media => 'all';
@ -414,11 +420,10 @@ sub htmlFooter {
sub htmlMenu { sub htmlMenu {
my($s, %o) = @_; my($s, %o) = @_;
my %spec = map +($_,1), qw|ncdu ncdc tuwf|; h1 class => 'title', "~ \u$o{page} ~" if $o{spec}{$o{page}};
h1 class => 'title', "~ \u$o{page} ~" if $spec{$o{page}};
my $m = sub { my $m = sub {
li; li;
my $s = $_[0] =~ m{^/([^/]+)} && $spec{$1} && $o{page} ne $1; my $s = $_[0] =~ m{^/([^/]+)} && $o{spec}{$1} && $o{page} ne $1;
a href => $_[0], $s?(class=>'special'):$_[2]?(class=>'menusel'):(), $_[1]; a href => $_[0], $s?(class=>'special'):$_[2]?(class=>'menusel'):(), $_[1];
if($_[3]) { if($_[3]) {
ul; ul;
@ -458,14 +463,19 @@ sub htmlMenu {
$m->('/ncdc', 'Ncdc '); $m->('/ncdc', 'Ncdc ');
$m->('/tuwf', 'Tuwf '); $m->('/tuwf', 'Tuwf ');
$m->('/doc', 'Articles', $o{page} eq 'doc'); $m->('/doc', 'Articles', $o{page} eq 'doc');
$m->('/dump', 'Code dump', $o{page} eq 'dump', $o{page} eq 'dump' && sub { $m->('/dump', 'Code dump', $o{page} eq 'dump', sub {
$m->('/dump', 'Misc.', !$o{sec}); $m->('/dump', 'Misc.', $o{page} eq 'dump' && !$o{sec});
$m->('/demo', 'Demos', $o{sec} eq 'demo'); $m->('/demo', 'Demos', $o{page} eq 'dump' && $o{sec} eq 'demo');
$m->('/dump/awshrink','AWShrink', $o{sec} eq 'awshrink'); $m->('/dump/awshrink','AWShrink', $o{page} eq 'dump' && $o{sec} eq 'awshrink');
$m->('/dump/grenamr', 'Grenamr', $o{sec} eq 'grenamr'); $m->('/dump/grenamr', 'Grenamr', $o{page} eq 'dump' && $o{sec} eq 'grenamr');
$m->('/dump/nccolour','NC-Colour', $o{sec} eq 'nccolour'); $m->('/dump/nccolour','NC-Colour', $o{page} eq 'dump' && $o{sec} eq 'nccolour');
}); });
} }
if($o{spec}{$o{page}}) {
li;
a href => '/', class => 'small special', 'Projects home ';
end;
}
end; end;
} }

View file

@ -24,10 +24,9 @@ html,body { background: #ccc; text-align: center; height: 100% }
#left li { margin: 0 0 20px 10px; list-style-type: none } #left li { margin: 0 0 20px 10px; list-style-type: none }
#left li a { text-decoration: none; display: block; width: 100px; border-bottom: 1px solid #fff } #left li a { text-decoration: none; display: block; width: 100px; border-bottom: 1px solid #fff }
#left li a:hover { border-bottom: 1px dashed #aaa } #left li a:hover { border-bottom: 1px dashed #aaa }
#left li li { margin-top: 10px } #left li li { margin-top: 10px; margin-bottom: 0 }
#left li li a { width: 90px } #left li li a { width: 90px }
#left li li li { margin-top: 2px } #left li a.small { font-size: 12px }
#left li li li a { width: 80px }
#left .menusel { color: #03a } #left .menusel { color: #03a }
#left .notes { margin-top: 50px; text-align: center } #left .notes { margin-top: 50px; text-align: center }
#left .notes, #left .notes a { font-size: 12px; text-decoration: none } #left .notes, #left .notes a { font-size: 12px; text-decoration: none }