more logical display of index entries
This commit is contained in:
parent
77ffee921c
commit
82d3be3129
1 changed files with 5 additions and 4 deletions
|
@ -33,19 +33,20 @@ $( document ).ready(function() {
|
||||||
fetch(url_entry)
|
fetch(url_entry)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(out => {
|
.then(out => {
|
||||||
let entrystring = out.form;
|
let entrystring = '';
|
||||||
let glosses = [];
|
let glosses = [];
|
||||||
for (r of e.refs) {
|
for (r of e.refs) {
|
||||||
if (r.glosses) {
|
if (r.glosses) {
|
||||||
for(g of r.glosses){
|
for(g of r.glosses){
|
||||||
glosses.push(g);
|
glosses.push(`‘${g}’`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(glosses.length > 0) {
|
if(glosses.length > 0) {
|
||||||
entrystring += ` (${glosses.join('; ')})`
|
entrystring = `${glosses.join('; ')}: `
|
||||||
}
|
}
|
||||||
$select_entry.append(new Option(entrystring,out.xmlid))
|
opt = $(`<option value="${out.xmlid}">${entrystring}<i>${out.form}</i></option>`);
|
||||||
|
$select_entry.append(opt)
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue