let answers = [word[2], this.words[1][2], this.words[2][2], this.words[3][2]]
.sort(() => {return .5 - Math.random()}) // shuffle
answers.forEach(suggest => {
- let option = put(form, 'li', suggest, {onclick: () => {
+ let label = suggest.replace(/\/.*/, '');
+ let option = put(form, 'li', label, {onclick: () => {
if (suggest != word[2]) {
// incorrect
put(option, '.wrong');
<script src="/word/quiz.js"></script>
<style>
img {
- max-width: 50%;
+ width: 90vw;
+ max-width: 64em;
+ margin: 2em 0 1ex;
}
-.wrong {background: red}
-.good {background: green}
+li {
+ font-size: 20pt;
+ padding: .2ex;
+}
+li:hover {
+ cursor: pointer;
+ background: #8888;
+}
+li.wrong {background: #F008}
+li.good {background: #0F08}
</style>
EOT
});
-say '<h1>quiz</h1><p id="quiz">test</p>';
+say '<h1 id=quiz>quiz</h1>';