summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-02-19 14:18:25 -0800
committerAlex Yatskov <alex@foosoft.net>2017-02-19 14:18:25 -0800
commita1ba96145d7a98f851d85cac5be640a69662f954 (patch)
tree7781ce86de7c9fd8df62d21904cd2b38b8b60c36 /ext/bg
parent76dd176706eddcdc605896093bb4efdfaeffa3c4 (diff)
parent5500ae27b24fc4242a5d180c129d649c3e992daa (diff)
Merge branch 'dev'
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/yomichan.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 80a67588..4c70bf0f 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -100,20 +100,23 @@ class Yomichan {
note.deckName = this.options.anki.terms.deck;
note.modelName = this.options.anki.terms.model;
- const audio = {
- kanji: definition.expression,
- kana: definition.reading,
- fields: []
- };
-
- for (const name in fields) {
- if (fields[name].includes('{audio}')) {
- audio.fields.push(name);
+ if (definition.audio) {
+ const audio = {
+ url: definition.audio.url,
+ filename: definition.audio.filename,
+ skipHash: '7e2c2f954ef6051373ba916f000168dc',
+ fields: []
+ };
+
+ for (const name in fields) {
+ if (fields[name].includes('{audio}')) {
+ audio.fields.push(name);
+ }
}
- }
- if (audio.fields.length > 0) {
- note.audio = audio;
+ if (audio.fields.length > 0) {
+ note.audio = audio;
+ }
}
}