more logical display of index entries

This commit is contained in:
Oleg Belyaev 2025-03-21 15:48:44 +03:00
parent 77ffee921c
commit 82d3be3129

View file

@ -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));
} }