keyboard/altgr: integrate css overiddes in common stylesheet
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 27 Jan 2024 20:57:09 +0000 (21:57 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 Jan 2024 17:17:48 +0000 (18:17 +0100)
Proper .big class usable anywhere using the tableclass parameter.

Shiar_Sheet/Keyboard.pm
Shiar_Sheet/KeyboardChars.pm
base.css
common.inc.plp
keyboard.plp
keyboard/altgr.css [deleted file]

index 327b20c01df7f38cb737be2e1b0f75426c42d568..1200003baca8345d20d7dfd0aeed370fbeff7de7 100644 (file)
@@ -150,7 +150,7 @@ sub print_rows {
        );
        my @modes = sort keys %{ $self->{def} };
 
-       print '<table id="rows" class="keys">'."\n\n";
+       printf '<table id="rows" class="%s">'."\n\n", $self->{tableclass} // 'keys';
 
 print_row:
        for (my $row = -1; $row <= $#{ $keyrows{$self->{map}} }; $row++) {
index 7290b5d8f76af7b60bb215f8c81b008f6d33e187..4a28f11cf6af900e9e086b522532a66152d21781 100644 (file)
@@ -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}) {
index 9e8058c913e1b2ec98e0468a79d6f89b055f5017..c349bdedfcaa0ed90cf55426a6635761e117fea7 100644 (file)
--- 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 {
index 0754d85acf7c8f8bfafd56f245691e0085678ed0..8a13059a5c50c139cb1f698c5f463a29d17f4354 100644 (file)
@@ -76,7 +76,7 @@ sub stylesheet {
 
        return map { sprintf(
                '<link rel="%s" type="text/css" media="all" href="%s" title="%s">',
-               $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.14", $_
+               $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.17", $_
        ) } @avail;
 }
 
index 4b4592775ffee14d4c182dd4b36951746cc39f9a..fa2aaf25d19ef2c7c0c461cd5e8e29cbb43b44c0 100644 (file)
@@ -22,11 +22,6 @@ my @keystyle = (
        $showkeys eq 'ghost' ? '<style> .no, .alias {opacity:.5} </style>' : (),
        '<script type="text/javascript" src="/keys.js?1.6" async></script>',
 );
-if ($Request =~ /^altgr/ and open my $cssinc, '<', 'keyboard/altgr.css') {
-       local $/;
-       my $data = readline $cssinc;
-       push @keystyle, "<style>\n$data</style>";
-}
 
 Html({
        title => "\L$mode\E keyboard cheat sheet",
diff --git a/keyboard/altgr.css b/keyboard/altgr.css
deleted file mode 100644 (file)
index 92a4393..0000000
+++ /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;
-}