aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/util.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-16 22:30:53 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-16 22:30:53 -0800
commit404f3f1b164fd924a8d34521f86bf3660acdc008 (patch)
treee197a07b87a71c0907a337902aecb0e300d5d4b3 /ext/bg/js/util.js
parent268e00435f081b81ac0426bd3e316acb1bb33915 (diff)
unify dictionary enabled state
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r--ext/bg/js/util.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index bba4d797..dcaf1e47 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -39,6 +39,18 @@ function isKanji(c) {
return code >= 0x4e00 && code < 0x9fb0 || code >= 0x3400 && code < 0x4dc0;
}
+function enabledDicts(options) {
+ const dictionaries = {};
+ for (const title in options.dictionaries) {
+ const dictionary = options.dictionaries[title];
+ if (dictionary.enabled) {
+ dictionaries[title] = dictionary;
+ }
+ }
+
+ return dictionaries;
+}
+
function promiseCallback(promise, callback) {
return promise.then(result => {
callback({result});