aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/dictionary.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-08-06 23:04:03 -0700
committerAlex Yatskov <alex@foosoft.net>2016-08-06 23:04:03 -0700
commit9468797b874bc39e8a9730fc67bb97fd2494f76f (patch)
tree178c28a9d482460818e5f16983cadc351a10702e /ext/bg/js/dictionary.js
parent08d92a4ddb3f9e008f572de2ce03ce6bf18599d6 (diff)
Use entity data from dictionary
Diffstat (limited to 'ext/bg/js/dictionary.js')
-rw-r--r--ext/bg/js/dictionary.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index b18e17ca..073b8f55 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -19,7 +19,7 @@
class Dictionary {
constructor() {
- this.termDicts = {};
+ this.termDicts = {};
this.kanjiDicts = {};
}
@@ -36,22 +36,21 @@ class Dictionary {
for (let name in this.termDicts) {
const dict = this.termDicts[name];
- const indexStr = dict.i[term] || null;
- if (indexStr === null) {
+ if (!(term in dict.i)) {
continue;
}
- const indices = indexStr.split(' ').map(Number);
+ const indices = dict.i[term].split(' ').map(Number);
results = results.concat(
indices.map(index => {
const [e, r, t, ...g] = dict.d[index];
- const addons = [];
- const tags = t.split(' ');
+ const tags = t.split(' ');
//
// TODO: Handle addons through data.
//
+ const addons = [];
for (let tag of tags) {
if (tag.startsWith('v5') && tag !== 'v5') {
addons.push('v5');
@@ -66,6 +65,7 @@ class Dictionary {
reading: r,
glossary: g,
tags: tags.concat(addons),
+ entities: dict.e,
addons: addons
};
})