git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
word/memory: manual grid size override option
[sheet.git]
/
word
/
memory.plp
diff --git
a/word/memory.plp
b/word/memory.plp
index 1bb8cebb3ae6211b609e4bf14fa513ef4776410a..11520b19b483d3a6860742e62b6ca151db83b39f 100644
(file)
--- a/
word/memory.plp
+++ b/
word/memory.plp
@@
-1,11
+1,25
@@
<(../common.inc.plp)><:
<(../common.inc.plp)><:
+our $wordlistbase;
+
Html({
raw => <<'EOT',
<script src="/word/put.min.js"></script>
Html({
raw => <<'EOT',
<script src="/word/put.min.js"></script>
+<script src="/word/quiz.js"></script>
<script src="/word/memory.js"></script>
<style>
/* cards */
<script src="/word/memory.js"></script>
<style>
/* cards */
+#quiz {
+ display: grid;
+ grid: repeat(3, 1fr) / repeat(4, 1fr);
+ grid-gap: 1ex;
+ min-height: calc(100vh - 11.5ex);
+}
+@media (orientation: portrait) {
+ #quiz {
+ grid: repeat(6, 1fr) / repeat(2, 1fr);
+ }
+}
html {
overflow: hidden; /* rotation overflow on celebration */
}
html {
overflow: hidden; /* rotation overflow on celebration */
}
@@
-14,9
+28,7
@@
figure {
display: inline-block;
background: #224;
border: 1px solid #888;
display: inline-block;
background: #224;
border: 1px solid #888;
- margin: 2px;
perspective: 100em;
perspective: 100em;
- height: 300px;
position: relative;
}
figure:not(.turn):hover {
position: relative;
}
figure:not(.turn):hover {
@@
-28,18
+40,22
@@
figure, img {
/* card faces */
figure img {
/* card faces */
figure img {
- height: 100%;
- width: auto;
backface-visibility: hidden;
transform: rotateY(180deg); /* back */
transform-style: preserve-3d;
backface-visibility: hidden;
transform: rotateY(180deg); /* back */
transform-style: preserve-3d;
- float: left; /* ff workaround to prevent click selection */
+ -float: left; /* ff workaround to prevent click selection */
+}
+figure.mirror img {
+ transform: rotateY(180deg) scaleX(-1);
}
/* turn results */
figure.turn img {
transform: rotateY(0deg);
}
}
/* turn results */
figure.turn img {
transform: rotateY(0deg);
}
+figure.mirror.turn img {
+ transform: rotateY(0deg) scaleX(-1);
+}
figure.bad img {
filter: sepia(.5) hue-rotate(-45deg) saturate(2); /* red tint */
}
figure.bad img {
filter: sepia(.5) hue-rotate(-45deg) saturate(2); /* red tint */
}
@@
-48,16
+64,24
@@
figure.good {
}
.good figure {
}
.good figure {
- animation: celebration
5
s linear infinite;
+ animation: celebration
7
s linear infinite;
background: none;
border: 0;
background: none;
border: 0;
+ opacity: 1;
}
@keyframes celebration {
0% { filter: hue-rotate(0deg); transform: rotate(0deg) }
}
@keyframes celebration {
0% { filter: hue-rotate(0deg); transform: rotate(0deg) }
- 50% { filter: hue-rotate(180deg); transform: rotate(180deg) }
+ 33% { filter: hue-rotate(180deg); transform: rotate(180deg) }
+ 66% { filter: hue-rotate(360deg); transform: rotate(360deg) }
100% { filter: hue-rotate(360deg); transform: rotate(360deg) }
}
</style>
EOT
});
100% { filter: hue-rotate(360deg); transform: rotate(360deg) }
}
</style>
EOT
});
+if (my $gridsize = $get{grid}) {
+ printf "<style>#quiz {grid: repeat(%d, 1fr) / repeat(%d, 1fr)}</style>",
+ reverse split /\D+/, $gridsize;
+ say '';
+}
say '<h1>memory</h1><p id="quiz"></p>';
say '<h1>memory</h1><p id="quiz"></p>';
+say "<script>new WordMemory('/$wordlistbase.json')</script>";