summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-27 20:11:06 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-27 20:11:06 -0800
commitd134c6b29732858ffad7a4b34d9dc90e4b4ec0fa (patch)
treef345067c52ee30085d30b186a4a76f3e3a129a52 /ext/bg/js
parentb3e4137340ef21b9be816d87ea1987e9ced80781 (diff)
options versioning
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/options.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 066ed62c..cd415d51 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -98,6 +98,22 @@ function optionsVersion(options) {
copy(options.anki.kanji, 'model', options, 'ankiKanjiModel');
copy(options.anki.kanji, 'fields', options, 'ankiKanjiFields');
+ const fixupFields = fields => {
+ const fixups = {
+ 'expression-furigana': 'furigana',
+ 'glossary-list': 'glossary'
+ };
+
+ for (let i = 0; i < fields.length; ++i) {
+ for (const fixup in fixups) {
+ fields[i] = value.replace(fields[i], fixups[fixup]);
+ }
+ }
+ };
+
+ fixupFields(options.anki.terms.fields);
+ fixupFields(options.anki.kanji.fields);
+
for (const title in options.dictionaries) {
const dictionary = options.dictionaries[title];
dictionary.enabled = dictionary.enableTerms || dictionary.enableKanji;