diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js index b3e8bf71..4120dd2b 100644 --- a/ext/bg/js/yomichan.js +++ b/ext/bg/js/yomichan.js @@ -146,7 +146,7 @@ class Yomichan { } } - formatField(field, definition, kana) { + formatField(field, definition, mode) { const supported = ['character', 'expression', 'glossary', 'kunyomi', 'onyomi', 'reading']; for (const key in definition) { @@ -155,18 +155,27 @@ class Yomichan { } let value = definition[key]; - if (kana) { + if (value !== null && typeof(value) !== 'string') { + value = value.join(', '); + } + + if (mode === 'vocab_kana') { if (key === 'expression') { value = definition.reading; } else if (key === 'reading') { - value = ''; + value = null; } } - if (key === 'glossary') { - value = definition.glossary.join('; '); + + if (mode !== 'kanji' && key === 'glossary') { + value = '