From: Mischa POSLAWSKY Date: Sun, 5 Jun 2022 19:06:41 +0000 (+0200) Subject: word: reload page to apply changed location hash X-Git-Tag: v1.14~73 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/8ed7634d0fa3b7154275c14477b361b358ee783f word: reload page to apply changed location hash --- diff --git a/base.css b/base.css index 6f34ef1..31429aa 100644 --- a/base.css +++ b/base.css @@ -736,7 +736,7 @@ figure img { } @media (min-width: 603px) and (min-height: 400px) { /* fit 3 cells of 200x133 */ - .gallery > ul > li:first-child > figure, + .gallery > li:first-child > figure, .gallery li.huge > figure { grid-row: span 3; grid-column: span 3; diff --git a/word/finder.js b/word/finder.js index ea1781d..5dcc9e3 100644 --- a/word/finder.js +++ b/word/finder.js @@ -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() {} diff --git a/word/finder.plp b/word/finder.plp index 6e302ba..ffaeb12 100644 --- a/word/finder.plp +++ b/word/finder.plp @@ -11,5 +11,5 @@ EOT }); say '

Words

'; -say ''; +say ''; say ""; diff --git a/word/quiz.js b/word/quiz.js index 1aaab61..a7194bb 100644 --- a/word/quiz.js +++ b/word/quiz.js @@ -89,5 +89,8 @@ class WordQuiz { window.onbeforeunload = e => { this.stop('abort'); }; + window.onhashchange = e => { + this.load(dataurl); + }; } }