diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-01-15 12:42:44 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-01-15 12:42:44 -0800 |
commit | 434ccc18ee22f5dcf0298e6516adf5e8273ecb6d (patch) | |
tree | a7bda23c9c69341d7918d81408cf55adbe6c2bb2 /ext/bg/js/options.js | |
parent | 0c88d3fa273667d30be3ae8e1ee8da527561aa9e (diff) |
dict priority work
Diffstat (limited to 'ext/bg/js/options.js')
-rw-r--r-- | ext/bg/js/options.js | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 19e028fb..027a1539 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -20,28 +20,28 @@ function optionsSetDefaults(options) { const defaults = { general: { - autoStart: true, + autoStart: true, audioPlayback: true, - softKatakana: true, - groupResults: true, - showAdvanced: false + softKatakana: true, + groupResults: true, + showAdvanced: false }, scanning: { requireShift: true, - selectText: true, - delay: 15, - length: 10 + selectText: true, + delay: 15, + length: 10 }, dictionaries: {}, anki: { - enable: false, - tags: ['yomichan'], + enable: false, + tags: ['yomichan'], sentenceExt: 200, - terms: {deck: '', model: '', fields: {}}, - kanji: {deck: '', model: '', fields: {}}, + terms: {deck: '', model: '', fields: {}}, + kanji: {deck: '', model: '', fields: {}} } }; @@ -53,10 +53,10 @@ function optionsSetDefaults(options) { } }; - combine(options, defaults); - combine(options.general, defaults.general); - combine(options.scanning, defaults.scanning); - combine(options.anki, defaults.anki); + combine(options, defaults); + combine(options.general, defaults.general); + combine(options.scanning, defaults.scanning); + combine(options.anki, defaults.anki); combine(options.anki.terms, defaults.anki.terms); combine(options.anki.kanji, defaults.anki.kanji); @@ -74,28 +74,32 @@ function optionsVersion(options) { () => { optionsSetDefaults(options); - copy(options.general, 'autoStart', options, 'activateOnStartup'); + copy(options.general, 'autoStart', options, 'activateOnStartup'); copy(options.general, 'audioPlayback', options, 'enableAudioPlayback'); - copy(options.general, 'softKatakana', options, 'enableSoftKatakanaSearch'); - copy(options.general, 'groupResults', options, 'groupTermResults'); - copy(options.general, 'showAdvanced', options, 'showAdvancedOptions'); + copy(options.general, 'softKatakana', options, 'enableSoftKatakanaSearch'); + copy(options.general, 'groupResults', options, 'groupTermResults'); + copy(options.general, 'showAdvanced', options, 'showAdvancedOptions'); copy(options.scanning, 'requireShift', options, 'holdShiftToScan'); - copy(options.scanning, 'selectText', options, 'selectMatchedText'); - copy(options.scanning, 'delay', options, 'scanDelay'); - copy(options.scanning, 'length', options, 'scanLength'); + copy(options.scanning, 'selectText', options, 'selectMatchedText'); + copy(options.scanning, 'delay', options, 'scanDelay'); + copy(options.scanning, 'length', options, 'scanLength'); options.anki.enable = options.ankiMethod === 'ankiconnect'; - copy(options.anki, 'tags', options, 'ankiCardTags'); - copy(options.anki, 'sentenceExt', options, 'sentenceExtent'); - copy(options.anki.terms, 'deck', options, 'ankiTermDeck'); - copy(options.anki.terms, 'model', options, 'ankiTermModel'); - copy(options.anki.terms, 'fields', options, 'ankiTermFields'); - copy(options.anki.kanji, 'deck', options, 'ankiKanjiDeck'); - copy(options.anki.kanji, 'model', options, 'ankiKanjiModel'); - copy(options.anki.kanji, 'fields', options, 'ankiKanjiFields'); - }, + copy(options.anki, 'tags', options, 'ankiCardTags'); + copy(options.anki, 'sentenceExt', options, 'sentenceExtent'); + copy(options.anki.terms, 'deck', options, 'ankiTermDeck'); + copy(options.anki.terms, 'model', options, 'ankiTermModel'); + copy(options.anki.terms, 'fields', options, 'ankiTermFields'); + copy(options.anki.kanji, 'deck', options, 'ankiKanjiDeck'); + copy(options.anki.kanji, 'model', options, 'ankiKanjiModel'); + copy(options.anki.kanji, 'fields', options, 'ankiKanjiFields'); + + for (const title in options.dictionaries) { + options.dictionaries[title].priority = 0; + } + } ]; if (options.version < fixups.length) { |