diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-01-16 22:30:53 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-01-16 22:30:53 -0800 |
commit | 404f3f1b164fd924a8d34521f86bf3660acdc008 (patch) | |
tree | e197a07b87a71c0907a337902aecb0e300d5d4b3 /ext/bg/js/yomichan.js | |
parent | 268e00435f081b81ac0426bd3e316acb1bb33915 (diff) |
unify dictionary enabled state
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r-- | ext/bg/js/yomichan.js | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js index 494b9cda..1f337680 100644 --- a/ext/bg/js/yomichan.js +++ b/ext/bg/js/yomichan.js @@ -157,54 +157,22 @@ class Yomichan { } api_findKanji({text, callback}) { - const dictionaries = {}; - for (const title in this.options.dictionaries) { - const dictionary = this.options.dictionaries[title]; - if (dictionary.enableKanji) { - dictionaries[title] = dictionary; - } - } - promiseCallback( - this.translator.findKanji(text, dictionaries), + this.translator.findKanji(text, enabledDicts(this.options)), callback ); } api_findTerms({text, callback}) { - const dictionaries = {}; - for (const title in this.options.dictionaries) { - const dictionary = this.options.dictionaries[title]; - if (dictionary.enableTerms) { - dictionaries[title] = dictionary; - } - } - promiseCallback( - this.translator.findTerms( - text, - dictionaries, - this.options.general.softKatakana - ), + this.translator.findTerms(text, enabledDicts(this.options), this.options.general.softKatakana), callback ); } api_findTermsGrouped({text, callback}) { - const dictionaries = {}; - for (const title in this.options.dictionaries) { - const dictionary = this.options.dictionaries[title]; - if (dictionary.enableTerms) { - dictionaries[title] = dictionary; - } - } - promiseCallback( - this.translator.findTermsGrouped( - text, - dictionaries, - this.options.general.softKatakana - ), + this.translator.findTermsGrouped(text, enabledDicts(this.options), this.options.general.softKatakana), callback ); } |