git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
word/quiz: decode uri-encoded location hash
[sheet.git]
/
word
/
finder.js
diff --git
a/word/finder.js
b/word/finder.js
index e842d0671d2b2321db5ba13798c48a7a9a219616..630db8e8f8ff21af26f979f17742658e32f91988 100644
(file)
--- a/
word/finder.js
+++ b/
word/finder.js
@@
-1,6
+1,5
@@
class WordFinder extends WordQuiz {
namehtml(name) {
class WordFinder extends WordQuiz {
namehtml(name) {
- //let wbr = new RegExp('\w{4} [^aoeuiyc\W] [rl]?+ \K (?= [^aoeuiy\W] [rl]? [aoeuiy] \w)', 'g');
let aliases = name.split('/');
let html = aliases.shift();
html = html.replace(/\((.+)\)/, '<small>$1</small>');
let aliases = name.split('/');
let html = aliases.shift();
html = html.replace(/\((.+)\)/, '<small>$1</small>');
@@
-11,25
+10,29
@@
class WordFinder extends WordQuiz {
}
add(catitem, rows) {
}
add(catitem, rows) {
- rows.forEach(
ref
=> {
-
const [title, level, imgid, subs] = this.data[ref]
;
+ rows.forEach(
word
=> {
+
if (!word) return
;
const worditem = put(catitem, 'li');
const figitem = put(worditem, 'figure');
const worditem = put(catitem, 'li');
const figitem = put(worditem, 'figure');
- if (imgid) {
- put(figitem, 'img[src=$]',
`/data/word/32/${imgid}.jpg`
);
+ if (
word.
imgid) {
+ put(figitem, 'img[src=$]',
word.thumb()
);
}
}
- if (title) {
+ if (
word.
title) {
put(figitem, 'figcaption', {
put(figitem, 'figcaption', {
- innerHTML: this.namehtml(title),
+ innerHTML: this.namehtml(
word.
title),
});
}
});
}
- if (level <= 1 && subs.length >= 2) {
+ put(worditem, '.level' + word.level);
+ if (word.level <= 1 && word.subs.length >= 4) {
put(worditem, '.large');
}
put(worditem, '.large');
}
- if (subs.length) {
+ if (
word.
subs.length) {
// delve into subcategory
put(worditem, '.parent');
// delve into subcategory
put(worditem, '.parent');
- this.add(put(worditem, 'ul'), subs);
+ this.add(put(worditem, 'ul'), word.subs);
+ }
+ if (this.preset.debug) {
+ put(figitem, '[title=$]', `id ${ref} level ${word.level}`);
}
});
}
}
});
}
@@
-42,9
+45,12
@@
class WordFinder extends WordQuiz {
setup() {
super.setup();
setup() {
super.setup();
+ if (this.preset.debug) {
+ put(document.head, 'link', {rel: 'stylesheet', href: '/word/debug.css'});
+ }
this.form.innerHTML = '';
put(this.form, 'p', 'Under construction.');
this.form.innerHTML = '';
put(this.form, 'p', 'Under construction.');
- for (let cat of this.
preset.cat || this.data[''][3]
) {
+ for (let cat of this.
data.root()
) {
this.add(put(this.form, 'ul.gallery'), [cat]);
}
}
this.add(put(this.form, 'ul.gallery'), [cat]);
}
}