diff --git a/static/index.html b/static/index.html
index 253b298..b07a5b5 100644
--- a/static/index.html
+++ b/static/index.html
@@ -310,6 +310,10 @@ Double-click any word to look it up on the right.">
@@ -740,6 +744,14 @@ const resultsBox = document.getElementById('lookupResults');
const histBar = document.getElementById('histBar');
const defBox = document.getElementById('defBox');
let curWord = null, lookupSeq = 0, entry = null;
+let subMode = 'explore';
+const subSeg = document.getElementById('subSeg');
+subSeg.addEventListener('click', e=>{
+ const b = e.target.closest('button'); if(!b) return;
+ subMode = b.dataset.sub;
+ [...subSeg.children].forEach(c=>c.classList.toggle('active', c.dataset.sub === subMode));
+ paintSections();
+});
const wordHistory = [];
lookupInput.addEventListener('focus', ()=> lookupInput.select());
@@ -840,34 +852,38 @@ function paintSections(){
const e = entry;
if(!e) return;
let h = '';
- if(e.trig && e.trig.length){
- // what the word summons — the theme-building lens
- h += `
associations
` + chipHtml(e.trig.map(d=>d.word));
+ if(subMode === 'explore'){
+ // the meaning side: what it summons, what describes it, what replaces it
+ if(e.trig && e.trig.length){
+ h += `
associations
` + chipHtml(e.trig.map(d=>d.word));
+ }
+ if(e.desc && e.desc.length){
+ h += `
describes
` + chipHtml(e.desc.map(d=>d.word));
+ }
+ if(e.syn && e.syn.known && e.syn.sections.length){
+ h += `
synonyms
`;
+ e.syn.sections.forEach(s=>{
+ if(s.label !== 'synonyms') h += `
${esc(s.label)}
`;
+ h += chipHtml(s.words.map(d=>d.word), s.label === 'synonyms' ? '' : 'near');
+ });
+ }
+ }else{
+ // the sound side: rhymes, near, multis
+ if(e.rhyme && e.rhyme.known && (e.rhyme.words.length || (e.rhyme.near || []).length)){
+ const bySyl = {};
+ e.rhyme.words.forEach(d=>{ (bySyl[d.syl || 0] ||= []).push(d); });
+ const onWord = e.rhyme.rhyme_on ? ` — on “${esc(e.rhyme.rhyme_on)}”` : '';
+ h += `
rhymes${onWord}
`;
+ Object.keys(bySyl).sort((a,b)=>a-b).forEach(k=>{
+ h += `
${k == 0 ? '?' : k} syl
` + chipHtml(bySyl[k]);
+ });
+ const near = e.rhyme.near || [];
+ if(near.length) h += `
near
` + chipHtml(near, 'near');
+ const multis = e.rhyme.multis || [];
+ if(multis.length) h += `
multis
` + chipHtml(multis);
+ }
}
- if(e.desc && e.desc.length){
- h += `
describes
` + chipHtml(e.desc.map(d=>d.word));
- }
- if(e.rhyme && e.rhyme.known && (e.rhyme.words.length || (e.rhyme.near || []).length)){
- const bySyl = {};
- e.rhyme.words.forEach(d=>{ (bySyl[d.syl || 0] ||= []).push(d); });
- const onWord = e.rhyme.rhyme_on ? ` — on “${esc(e.rhyme.rhyme_on)}”` : '';
- h += `
rhymes${onWord}
`;
- Object.keys(bySyl).sort((a,b)=>a-b).forEach(k=>{
- h += `
${k == 0 ? '?' : k} syl
` + chipHtml(bySyl[k]);
- });
- const near = e.rhyme.near || [];
- if(near.length) h += `
near
` + chipHtml(near, 'near');
- const multis = e.rhyme.multis || [];
- if(multis.length) h += `
multis
` + chipHtml(multis);
- }
- if(e.syn && e.syn.known && e.syn.sections.length){
- h += `
synonyms
`;
- e.syn.sections.forEach(s=>{
- if(s.label !== 'synonyms') h += `
${esc(s.label)}
`;
- h += chipHtml(s.words.map(d=>d.word), s.label === 'synonyms' ? '' : 'near');
- });
- }
- resultsBox.innerHTML = h || `
nothing found for “${esc(e.word)}”.
`;
+ resultsBox.innerHTML = h || `
nothing here for “${esc(e.word)}”.
`;
resultsBox.querySelectorAll('.chip').forEach(c=>
c.addEventListener('click', ()=> lookupFor(c.dataset.w)));
}