<(common.inc.plp)><:
-my $wordlist = 'wordlist.en.inc.pl';
+if ($Request and $Request =~ s{^edit/?}{}) {
+ Include 'writer.plp';
+ exit;
+}
+
+if ($Request and $Request =~ s{^quiz/?}{}) {
+ Html({
+ raw => <<'EOT',
+<script src="/wordquiz.js"></script>
+<style>
+.wrong {background: red}
+.good {background: green}
+</style>
+EOT
+ });
+ say '<h1>quiz</h1><p id="quiz">test</p>';
+ exit;
+}
+
+my $lang = $get{lang} || 'en';
+my $wordlist = "data/wordlist.$lang.inc.pl";
my $limit = $get{v} // (exists $get{v} ? 4 : 3);
Html({
language
'],
data => [$wordlist],
- raw => <<'EOT',
+ raw => (exists $get{q} && <<'EOT')
+<style>
+.gallery figure {
+ grid-row: span 1 !important;
+ grid-column: span 1 !important;
+}
+.gallery figcaption {
+ /* keep hover position */
+ right: 50%;
+ bottom: 50%;
+ transform: translate(50%, 50%);
+ /* hide */
+ visibility: hidden;
+ font-size: 0 !important;
+}
+.gallery figure:active > figcaption {
+ visibility: visible;
+ font-size: 175% !important;
+}
+</style>
+EOT
+ . <<'EOT',
<style>
body {
margin: 8px 1px;
<p>
Under construction.
Zie ook <a href="/dieren">dieren</a>.
+<a href="?q">Omit translations</a> to test.
</p>
<:
}
say '<section class="gallery">';
-printimgs($table->{''}->[0]);
+if (exists $get{q}) {
+ my @rows;
+ if ($Request) {
+ my @query = $Request;
+ while (@query) {
+ push @rows, grep { (split /:/)[1] <= $limit } @query;
+ s/:.*// for @query;
+ @query = map {$_ ? @{$_} : ()} @{$table}{@query};
+ }
+ }
+ else {
+ @rows = map {ref ? @$_ : $_} values %{$table}; # flatten categories
+ }
+ @rows = sort { rand <=> .5 } @rows;
+ $table = {};
+ printimgs(@rows);
+}
+else {
+ printimgs($Request || $table->{''}->[0]);
+}
say '</section>';