formatchar: separate anno and style options
[sheet.git] / starcraft.plp
1 <:
2 use utf8;
3 use strict;
4 use warnings;
5 no  warnings 'qw';  # you know what you doing
6 no  warnings 'uninitialized';  # save some useless checks for more legible code
7
8 use Shiar_Sheet::KeySigns qw(%sign);
9
10 our $VERSION = 'v1.0';
11
12 $header{content_type} = "text/html; charset=$sign{charset}";
13
14 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
15  "http://www.w3.org/TR/html4/loose.dtd">
16 <html>
17
18 <head>
19 <title>starcraft cheat sheet</title>
20 <meta http-equiv="content-type" content="<:= $header{content_type} :>">
21 <link rel="stylesheet" type="text/css" media="all" href="base.css">
22 <!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
23 <!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
24         my %styles = map {$_ => $_} qw(dark circus mono red terse);
25         our $style = exists $get{style} && $styles{$get{style}} || 'light';
26         printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
27                 $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "$_.css", $_
28         ) for keys %styles;
29
30         our $showkeys = exists $get{keys} && $get{keys} ne '0';
31         print "\n<style> .no {visibility:hidden} </style>" unless $showkeys;
32         print "\n<style> .no, .alias {opacity:.5} </style>"
33                 if $showkeys and $get{keys} eq 'ghost';
34 :>
35 <script type="text/javascript" src="/keys.js"></script>
36
37 <body id="starcraft">
38
39 <h1>StarCraft cheat sheet</h1>
40
41 <h2>normal mode (default)</h2>
42
43 <ul id="rows">
44
45 <li class="row">
46         <ul class="keys omni">
47         <li class="mv chr27" onclick="setmode()"><b>Esc</b> normal mode
48                 <!-- not as static anymore, but never bothered; just see ^[ -->
49         </ul>
50 </li>
51
52 <:
53 use Shiar_Sheet::Keyboard 2;
54 my $info = do 'starcraft.eng.inc.pl' or die $@;
55 $info->{def} = do 'starcraft.inc.pl';
56 my $keys = Shiar_Sheet::Keyboard->new($info);
57 $keys->map($get{map}) or undef $get{map};
58 $keys->print_rows($get{rows} || '1 =P1 Z1', [0]);
59 :>
60 </ul>
61
62 <hr>
63
64 <div class="help">
65         <div class="left">
66                 <dl class="legend legend-types">
67                 <dt class="ci">ability
68                         <dd>Unit action available after upgrade.
69                 <dt class="pm">action
70                         <dd>Default unit action.
71                 <dt class="po">
72                         <dd>
73                 <dt class="co">unit
74                         <dd>Unit available at all times.
75                 <dt class="cp">dep unit
76                         <dd>Unit with dependencies.
77                 <dt class="mi">
78                         <dd>
79                 <dt class="mo">build
80                         <dd>Unit producing construction.
81                 <dt class="mv">upgrade
82                         <dd>Building or research providing unit upgrade.
83                 <dt class="me">other
84                         <dd>Miscellaneous facility.
85                 </dl>
86         </div>
87
88         <div class="right">
89                 <dl class="legend legend-options">
90                 <dt>key<:= $sign{arg} :>
91                         <dd>Commands with a dot need a char argument afterwards.
92                 <dt>key<:= $sign{args} :>
93                         <dd>Commands with two dots require variable arguments afterwards.
94                 </dl>
95
96                 <ul class="legend legend-set">
97                 <li>keyboard <strong>map</strong> is
98                         <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
99                 <li><strong>ascii</strong> mode is
100                         <:= defined $sign{-ascii} && 'forced ' :><em><:=
101                                 $sign{-ascii} ? 'on' : 'off' :></em>
102                 <li><strong>keys</strong> are
103                         <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
104                                 !exists $get{keys} && ' by default' :>
105                 <li>default <strong>style</strong> is
106                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
107                 </ul>
108         </div>
109 </div>
110
111 <p class="footer">
112         <a href="/" rel="home">sheet.shiar.nl</a>/starcraft
113         <a href="git://git.shiar.nl/sheet" rel="vcs-git" title="Git repository"><:= $VERSION :></a>
114         created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
115         <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
116            href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a>
117 </p>
118
119 </html>