From e11c9d17e6e5a1f418adc7ab3a83a7775919624c Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 4 May 2012 16:26:11 +0200 Subject: [PATCH] Minor menu cleanup + add "Projects home" link --- index.cgi | 30 ++++++++++++++++++++---------- style.css | 5 ++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/index.cgi b/index.cgi index e404a21..9c544a2 100755 --- a/index.cgi +++ b/index.cgi @@ -368,7 +368,13 @@ sub genChanges { sub htmlHeader { my $s = shift; - my %o = (page => '', sec => '', sec2 => '', @_ ); + my %o = ( + spec => { map +($_,1), qw|ncdu ncdc tuwf| }, + page => '', + sec => '', + sec2 => '', + @_ + ); html; head; Link rel => 'stylesheet', href => '/style.css', type => 'text/css', media => 'all'; @@ -414,11 +420,10 @@ sub htmlFooter { sub htmlMenu { my($s, %o) = @_; - my %spec = map +($_,1), qw|ncdu ncdc tuwf|; - h1 class => 'title', "~ \u$o{page} ~" if $spec{$o{page}}; + h1 class => 'title', "~ \u$o{page} ~" if $o{spec}{$o{page}}; my $m = sub { 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]; if($_[3]) { ul; @@ -458,14 +463,19 @@ sub htmlMenu { $m->('/ncdc', 'Ncdc '); $m->('/tuwf', 'Tuwf '); $m->('/doc', 'Articles', $o{page} eq 'doc'); - $m->('/dump', 'Code dump', $o{page} eq 'dump', $o{page} eq 'dump' && sub { - $m->('/dump', 'Misc.', !$o{sec}); - $m->('/demo', 'Demos', $o{sec} eq 'demo'); - $m->('/dump/awshrink','AWShrink', $o{sec} eq 'awshrink'); - $m->('/dump/grenamr', 'Grenamr', $o{sec} eq 'grenamr'); - $m->('/dump/nccolour','NC-Colour', $o{sec} eq 'nccolour'); + $m->('/dump', 'Code dump', $o{page} eq 'dump', sub { + $m->('/dump', 'Misc.', $o{page} eq 'dump' && !$o{sec}); + $m->('/demo', 'Demos', $o{page} eq 'dump' && $o{sec} eq 'demo'); + $m->('/dump/awshrink','AWShrink', $o{page} eq 'dump' && $o{sec} eq 'awshrink'); + $m->('/dump/grenamr', 'Grenamr', $o{page} eq 'dump' && $o{sec} eq 'grenamr'); + $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; } diff --git a/style.css b/style.css index 62aac69..3e40a7b 100644 --- a/style.css +++ b/style.css @@ -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 a { text-decoration: none; display: block; width: 100px; border-bottom: 1px solid #fff } #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 li { margin-top: 2px } -#left li li li a { width: 80px } +#left li a.small { font-size: 12px } #left .menusel { color: #03a } #left .notes { margin-top: 50px; text-align: center } #left .notes, #left .notes a { font-size: 12px; text-decoration: none }