word/finder: defer group collapsing
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 19 Dec 2023 19:25:03 +0000 (20:25 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 28 Dec 2023 07:19:58 +0000 (08:19 +0100)
Revert to a more expanded initial state as before commit
v1.13-78-gbe8886dee5 (2023-05-09) [collapse categories until clicked]
while keeping the added collapse feature.

word/finder.js

index 3dca29b8711061be90d9cbe5193fbca7c8329c7e..fffc552d68cc16692f5df407d488c6a661b988a9 100644 (file)
@@ -22,8 +22,14 @@ class WordFinder extends WordQuiz {
                        if (word.level <= 1 && word.subs.length >= 4) {
                                put(worditem, '.large');
                        }
-                       put(worditem, '.parent.expand');
+                       if (true) {
+                               // delve into subcategory
+                               put(worditem, '.parent');
+                               const expansion = put(worditem, 'ul');
+                               this.add(expansion, word.subs);
+                       }
 
+                       // hide or reselect subcategories
                        put(figitem, '[data-sup=$]', word.subs.length);
                        figitem.onclick = () => {
                                let expansion;
@@ -36,18 +42,11 @@ class WordFinder extends WordQuiz {
                                this.add(expansion, word.subs);
                                put(worditem, '!expand');
                        };
-                       return;
-
-                       // delve into subcategory
-                       const expansion = put(worditem, 'ul');
-                       //expansion.style.display = 'none';
-                       this.add(expansion, word.subs);
-                       //worditem.onclick = () => expansion.style.display = '';
                });
        }
 
        configure(input) {
-               this.preset.level = 3;
+               this.preset.level = 1;
                this.preset.images = false;
                return super.configure(input);
        }