summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-10-10 20:51:42 -0700
committerAlex Yatskov <alex@foosoft.net>2016-10-10 20:51:42 -0700
commita949e66a6c244447e6e3b28b4a24954e68f0be5d (patch)
tree3a5ff256844da424f75405340269b015569193a5 /ext/bg
parentf85874f97bea9276ce2edcc9ab7647e39759e29b (diff)
Fixes
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/anki.js9
-rw-r--r--ext/bg/js/options-form.js2
-rw-r--r--ext/bg/js/yomichan.js5
3 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js
index 73f0d479..a359f021 100644
--- a/ext/bg/js/anki.js
+++ b/ext/bg/js/anki.js
@@ -17,10 +17,10 @@
*/
class AnkiConnect {
- constructor(apiVersion) {
+ constructor() {
this.asyncPools = {};
- this.apiVersion = apiVersion;
- this.ankiConnectVer = 0;
+ this.pluginVersion = null;
+ this.apiVersion = 1;
}
addNote(note) {
@@ -48,12 +48,13 @@ class AnkiConnect {
}
ankiInvokeSafe(action, params, pool) {
- if (this.ankiConnectVer === this.apiVersion) {
+ if (this.pluginVersion === this.apiVersion) {
return this.ankiInvoke(action, params, pool);
}
return this.getVersion().then(version => {
if (version === this.apiVersion) {
+ this.pluginVersion = version;
return this.ankiInvoke(action, params, pool);
}
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index ed8c7927..6508a9eb 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -39,7 +39,7 @@ function modelIdToFieldOptKey(id) {
function modelIdToMarkers(id) {
return {
- 'anki-term-model': ['audio', 'exholdion', 'glossary', 'glossary-list', 'reading', 'sentence', 'tags', 'url'],
+ 'anki-term-model': ['audio', 'expression', 'glossary', 'glossary-list', 'reading', 'sentence', 'tags', 'url'],
'anki-kanji-model': ['character', 'glossary', 'glossary-list', 'kunyomi', 'onyomi', 'url'],
}[id];
}
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index c641bf6b..25dbc23c 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -23,9 +23,9 @@ class Yomichan {
Handlebars.registerHelper('kanjiLinks', kanjiLinks);
this.translator = new Translator();
+ this.anki = new AnkiConnect();
this.options = null;
this.importTabId = null;
- this.anki = new AnkiConnect(this.getApiVersion());
this.setState('disabled');
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
@@ -248,7 +248,6 @@ class Yomichan {
this.anki.canAddNotes(notes).then(results => {
const states = [];
-
if (results !== null) {
for (let resultBase = 0; resultBase < results.length; resultBase += modes.length) {
const state = {};
@@ -269,7 +268,7 @@ class Yomichan {
}
api_getModelNames({callback}) {
- this.anki.getModelFieldNames().then(callback);
+ this.anki.getModelNames().then(callback);
}
api_getModelFieldNames({modelName, callback}) {