1 class WordFinder extends WordQuiz {
5 const worditem = put(catitem, 'li');
6 const figitem = put(worditem, 'figure');
8 put(figitem, 'img[src=$]', word.thumb());
11 put(figitem, 'figcaption', {
15 if (this.preset.debug) {
16 put(figitem, '[title=$]', `id ${word.id} level ${word.level}`);
18 put(worditem, '.level' + word.level);
19 if (!word.subs.length) {
22 if (word.level <= 1 && word.subs.length >= 4) {
23 put(worditem, '.large');
26 // delve into subcategory
27 put(worditem, '.parent');
28 const expansion = put(worditem, 'ul');
29 this.add(expansion, word.subs);
32 // hide or reselect subcategories
33 put(figitem, '[data-sup=$]', word.subs.length);
34 figitem.onclick = () => {
36 if (expansion = worditem.querySelector('ul')) {
38 put(worditem, '.expand');
41 expansion = put(worditem, 'ul');
42 this.add(expansion, word.subs);
43 put(worditem, '!expand');
49 this.preset.level = 1;
50 this.preset.images = false;
51 return super.configure(input);
56 if (this.preset.debug) {
57 put(document.head, 'link', {rel: 'stylesheet', href: '/word/debug.css'});
59 this.form.innerHTML = '';
60 put(this.form, 'p', 'Under construction.');
61 for (let cat of this.data.root()) {
62 this.add(put(this.form, 'ul.gallery'), [cat]);