sc: single row >48em width by omitting category column
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 29 May 2022 13:05:35 +0000 (15:05 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 2 Jun 2022 21:57:11 +0000 (23:57 +0200)
Fit larger styling on intermediate widths below 52em.

sc.css
sc.plp

diff --git a/sc.css b/sc.css
index d670cf8b57cf0b82f48fe68d81cba3c098e2d452..0c0a829c1b670bf950ed237363c626fef4c48264 100644 (file)
--- a/sc.css
+++ b/sc.css
@@ -9,7 +9,6 @@
        padding: 0 0.2em;
        background: transparent;
        text-align: left;
-       vertical-align: top;
 }
 tr.alt td {
        font-size: 70%;
@@ -107,26 +106,29 @@ td.hurtrel {
 }
 
 @media (max-width: 52em) {
+       .units thead th:first-child,
+       .units tbody .cat {
+               position: absolute;
+               visibility: hidden;
+       }
+}
+@media (max-width: 48em) {
        .units {
                width: auto;
        }
-       .units th {
+       .units th, .units td {
+               vertical-align: top;
        }
        .units td {
                height: 2em;
        }
 
-       .units tbody .cat {
-               position: absolute;
-               visibility: hidden;
-       }
        .units td:nth-child(2) {
-               max-width: 6.5em;
                white-space: normal;
-               overflow: hidden;
+               padding: 0;
        }
 
-       .units thead th:first-child,
+       .units tr.sub td:nth-child(2),
        .units .cat,
        .units .unit-speed,
        .units .hurtrel,
diff --git a/sc.plp b/sc.plp
index 3c018e56c86ab60846cc1a7cc13cc2773845d5fd..3c19fce353db8aff37c84b24153adeae9192e0da 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -356,12 +356,11 @@ sub showrangeint {
                        $_->{attr}->{jump}
                                && qq'<span class="unit unit-jump" title="$_->{attr}->{jump}">↕</span>',
                        '<td class="unit-magic">' . showmagic($_),
-                       !$_->{attack}->[1] ? () : (
-                               '<tr><th class="cat" colspan="2"><td colspan=10>', showattack($_, 1), '<td colspan=3>'
-                       ),
-                       !$_->{attack}->[2] ? () : (
-                               '<tr><th class="cat" colspan="2"><td colspan=10>', showattack($_, 2), '<td colspan=3>'
-                       ),
+                       (map {(
+                               '<tr class="sub"><th class="cat"><td><td colspan=10>',
+                               showattack($row, $_),
+                               '<td colspan=3>',
+                       )} 1 .. $#{ $_->{attack} }),
                        "\n"
                );
        }