diff --git a/static/index.js b/static/index.js index 43388f2..ab61396 100644 --- a/static/index.js +++ b/static/index.js @@ -72,7 +72,7 @@ function generateTable(schemas, pos, forms) { if(!schema) return generateList(forms); - let html = '
'; + let html = '
'; html += ''; schema.rows.forEach(row => { @@ -90,7 +90,7 @@ function generateTable(schemas, pos, forms) { }); html += '
'; - html += '
'; + html += '
'; let unusedCells = forms.filter(cell => !cell.used); @@ -117,9 +117,17 @@ function generateHtml(word, data) { data.forEach(entry => { html += `

${entry.word} (${entry.pos})

` if('senses' in entry) { - if('tags' in entry.senses[0]) { - html += '
' - html += entry.senses[0].tags.map(tag => `${tag}`).join(', '); + let tags = []; + entry.senses.forEach(sense => { + if('tags' in sense) { + tags.push(...sense.tags); + } + }); + + if(tags.length > 0) { + tags = [...new Set(tags)]; + html += '
Tags: ' + html += tags.map(tag => `${tag}`).join(', ') html += '
' }