aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r--ext/mixed/js/display.js23
1 files changed, 6 insertions, 17 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 29a292c1..050caf4e 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -251,24 +251,13 @@ class Display {
noteAdd(definition, mode) {
this.spinner.show();
-
- let promise = Promise.resolve();
- if (mode !== 'kanji') {
- const filename = Display.audioBuildFilename(definition);
- if (filename) {
- promise = audioBuildUrl(definition, this.responseCache).then(url => definition.audio = {url, filename}).catch(() => {});
+ return this.definitionAdd(definition, mode).then(success => {
+ if (success) {
+ const index = this.definitions.indexOf(definition);
+ Display.adderButtonFind(index, mode).addClass('disabled');
+ } else {
+ this.handleError('note could not be added');
}
- }
-
- promise.then(() => {
- return this.definitionAdd(definition, mode).then(success => {
- if (success) {
- const index = this.definitions.indexOf(definition);
- Display.adderButtonFind(index, mode).addClass('disabled');
- } else {
- this.handleError('note could not be added');
- }
- });
}).catch(this.handleError.bind(this)).then(() => this.spinner.hide());
}