From 0f1264a15b66ff3682c5ebe2b9af8d2936a302f9 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 27 Jan 2024 21:57:09 +0100 Subject: [PATCH] keyboard/altgr: integrate css overiddes in common stylesheet Proper .big class usable anywhere using the tableclass parameter. --- Shiar_Sheet/Keyboard.pm | 2 +- Shiar_Sheet/KeyboardChars.pm | 1 + base.css | 41 ++++++++++++++++++++++++++++++++++++ common.inc.plp | 2 +- keyboard.plp | 5 ----- keyboard/altgr.css | 38 --------------------------------- 6 files changed, 44 insertions(+), 45 deletions(-) delete mode 100644 keyboard/altgr.css diff --git a/Shiar_Sheet/Keyboard.pm b/Shiar_Sheet/Keyboard.pm index 327b20c..1200003 100644 --- a/Shiar_Sheet/Keyboard.pm +++ b/Shiar_Sheet/Keyboard.pm @@ -150,7 +150,7 @@ sub print_rows { ); my @modes = sort keys %{ $self->{def} }; - print ''."\n\n"; + printf '
'."\n\n", $self->{tableclass} // 'keys'; print_row: for (my $row = -1; $row <= $#{ $keyrows{$self->{map}} }; $row++) { diff --git a/Shiar_Sheet/KeyboardChars.pm b/Shiar_Sheet/KeyboardChars.pm index 7290b5d..4a28f11 100644 --- a/Shiar_Sheet/KeyboardChars.pm +++ b/Shiar_Sheet/KeyboardChars.pm @@ -32,6 +32,7 @@ sub kbchars ($rows) { sub kbmodes ($modes) { my %g; # present group classes my %info = ( + tableclass => 'keys big', rows => [1, 0], ); for my $lead (keys %{$modes}) { diff --git a/base.css b/base.css index 9e8058c..c349bde 100644 --- a/base.css +++ b/base.css @@ -243,6 +243,47 @@ dl.legend dt, font-weight: normal; /* nice and subtle */ } +/* enlarged keys */ + +.keys.big td { + width: 1em; + min-width: auto; + height: 2.25ex; + font-size: 200%; + font-size: calc(7vmin - 4px); /* fit 12 keys to page */ + overflow: visible; + position: relative; + padding: 0; + margin: 0 .2vw -1px; +} + +/* override row alignments */ +.keys.big tbody { + font-size: calc(1.4vmin); /* enlarged td conversion */ +} +.keys.big .row2 {margin-left: 7em} +.keys.big .row3 {margin-left: 8em} +.keys.big .row4 {margin-left: 10em} +.keys.big .row0 { + display: none; /* headerless */ +} + +.keys.big td b { + position: absolute; /* overlay */ + z-index: 1; + top: -1.2ex; /* halfway over shift */ + left: 0; + right: 0; + font-size: 50%; + opacity: .5; + color: #FFF; + line-height: 2.25ex; +} +.keys.big .meta td b, +.keys.big .shift td b { + display: none; +} + /* tables */ table { diff --git a/common.inc.plp b/common.inc.plp index 0754d85..8a13059 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -76,7 +76,7 @@ sub stylesheet { return map { sprintf( '', - $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.14", $_ + $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.17", $_ ) } @avail; } diff --git a/keyboard.plp b/keyboard.plp index 4b45927..fa2aaf2 100644 --- a/keyboard.plp +++ b/keyboard.plp @@ -22,11 +22,6 @@ my @keystyle = ( $showkeys eq 'ghost' ? '' : (), '', ); -if ($Request =~ /^altgr/ and open my $cssinc, '<', 'keyboard/altgr.css') { - local $/; - my $data = readline $cssinc; - push @keystyle, ""; -} Html({ title => "\L$mode\E keyboard cheat sheet", diff --git a/keyboard/altgr.css b/keyboard/altgr.css deleted file mode 100644 index 92a4393..0000000 --- a/keyboard/altgr.css +++ /dev/null @@ -1,38 +0,0 @@ -.keys td { - width: 1em; - min-width: auto; - height: 2.25ex; - font-size: 200%; - font-size: calc(7vmin - 4px); /* fit 12 keys to page */ - overflow: visible; - position: relative; - padding: 0; - margin: 0 .2vw -1px; -} - -/* row alignments */ -.keys tbody { - font-size: calc(1.4vmin); /* enlarged td conversion */ -} -.row2 {margin-left: 7em} -.row3 {margin-left: 8em} -.row4 {margin-left: 10em} -.keys .row0 { - display: none; /* headerless */ -} - -.keys td b { - position: absolute; /* overlay */ - z-index: 1; - top: -1.2ex; /* halfway over shift */ - left: 0; - right: 0; - font-size: 50%; - opacity: .5; - color: #FFF; - line-height: 2.25ex; -} -.keys .meta td b, -.keys .shift td b { - display: none; -} -- 2.30.0