3 my $mode = lc($Request || 'altgr');
4 my $include = "$mode.eng";
6 my $info = eval { Data($include) } || {};
7 warn "error in $include: ", @{$@} if ref $@;
8 $mode = $info->{title} // $mode;
10 my $showkeys //= !exists $get{keys} ? undef :
11 ($get{keys} ne '0' && ($get{keys} || 'always'));
13 '<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->',
14 '<!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]-->',
15 !$showkeys ? '<style> .no {visibility:hidden} </style>' :
16 $showkeys eq 'ghost' ? '<style> .no, .alias {opacity:.5} </style>' : (),
17 '<script type="text/javascript" src="/keys.js?1.6" async></script>',
21 title => "\L$mode\E keyboard cheat sheet",
22 version => $info->{version} || '0.1',
23 description => $info->{description} //
24 ["Keyboard cheat sheet for the default controls of $mode."],
25 keywords => [@{ $info->{keywords} // [] }, qw'
26 sheet cheat reference overview keyboard control commands shortkey
28 stylesheet => [qw( light dark circus mono red )],
29 data => ["$include.inc.pl"],
34 "Requested keyboard <q>$mode</q> not available",
35 '404 request not found',
38 say "<h1>$mode cheat sheet</h1>";
39 say "<p>$_</p>" for $info->{intro} // ();
40 say "<h2>", $info->{mode}->{''}, " (default)</h2>"
41 if $info->{mode} and %{ $info->{mode} } > 1;
43 use Shiar_Sheet::Keyboard 2.08;
44 my $keys = Shiar_Sheet::Keyboard->new($info);
45 $keys->map($get{map}) or undef $get{map};
46 $keys->print_rows($get{rows} || $info->{moderows}, $info->{rows});
50 say '<div class="help">';
52 use List::MoreUtils qw( part );
53 my @gflags = part {/^g\d/} sort keys %{ $keys->{flag} };
55 say "\t", '<div class="left">';
56 $keys->print_legend('legend-types', $gflags[1]);
59 say "\t", '<div class="right">';
60 $keys->print_legend('legend-options', $gflags[0]);
63 say "\t\t", '<ul class="legend legend-set">';
65 say "\t\t<li>keyboard <strong>map</strong> is ",
66 ($get{map} ? 'set to ' : ''), "<em>$keys->{map}</em>";
67 say "\t\t<li><strong>keys</strong> are ",
68 "<em>", ($showkeys ? 'always shown' : 'hidden if unassigned'), "</em>",
69 (!defined $showkeys && ' by default');
70 say "\t\t<li>default <strong>style</strong> is ",
71 (defined $get{style} && 'set to '), "<em>$style</em>";