word: reload page to apply changed location hash
[sheet.git] / word / finder.js
index ea1781d16ad3d5ee528d7b027a79ee62a0a8d648..5dcc9e3de93f079521c4be441f0345795ce99c78 100644 (file)
@@ -1,6 +1,5 @@
 class WordFinder extends WordQuiz {
-       add(parentitem, rows) {
-               const catitem = put(parentitem, 'ul');
+       add(catitem, rows) {
                rows.forEach(ref => {
                        const [title, level, imgid, subs] = this.data[ref];
                        const worditem = put(catitem, 'li');
@@ -20,15 +19,18 @@ class WordFinder extends WordQuiz {
                        if (subs.length) {
                                // delve into subcategory
                                put(worditem, '.parent');
-                               this.add(worditem, subs);
+                               this.add(put(worditem, 'ul'), subs);
                        }
                });
        }
 
        setup() {
                this.gallery = document.getElementById('gallery');
-               put(this.gallery, '-p', 'Under construction.');
-               this.add(this.gallery, this.preset.cat ? [this.preset.cat] : this.data[''][3]);
+               this.gallery.innerHTML = '';
+               put(this.gallery, 'p', 'Under construction.');
+               for (let cat of this.preset.cat ? [this.preset.cat] : this.data[''][3]) {
+                       this.add(put(this.gallery, 'ul.gallery'), [cat]);
+               }
        }
 
        stop() {}