aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-16 20:54:01 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-16 20:54:01 -0800
commit268e00435f081b81ac0426bd3e316acb1bb33915 (patch)
tree1b93e3110058a56b14e0cbf5fe52d89916af744e /ext/bg/js/yomichan.js
parente8840465f07f09fbb9acb6071b94489f02ecd87f (diff)
support for dictionary priority sorting
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r--ext/bg/js/yomichan.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 27077f57..494b9cda 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -157,10 +157,11 @@ class Yomichan {
}
api_findKanji({text, callback}) {
- const dictionaries = [];
+ const dictionaries = {};
for (const title in this.options.dictionaries) {
- if (this.options.dictionaries[title].enableKanji) {
- dictionaries.push(title);
+ const dictionary = this.options.dictionaries[title];
+ if (dictionary.enableKanji) {
+ dictionaries[title] = dictionary;
}
}
@@ -171,10 +172,11 @@ class Yomichan {
}
api_findTerms({text, callback}) {
- const dictionaries = [];
+ const dictionaries = {};
for (const title in this.options.dictionaries) {
- if (this.options.dictionaries[title].enableTerms) {
- dictionaries.push(title);
+ const dictionary = this.options.dictionaries[title];
+ if (dictionary.enableTerms) {
+ dictionaries[title] = dictionary;
}
}
@@ -189,10 +191,11 @@ class Yomichan {
}
api_findTermsGrouped({text, callback}) {
- const dictionaries = [];
+ const dictionaries = {};
for (const title in this.options.dictionaries) {
- if (this.options.dictionaries[title].enableTerms) {
- dictionaries.push(title);
+ const dictionary = this.options.dictionaries[title];
+ if (dictionary.enableTerms) {
+ dictionaries[title] = dictionary;
}
}