diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-05-05 20:27:04 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-05-05 20:27:04 -0700 |
commit | 809e4f855fe26f602f65f072a6e8f2cd7b96359f (patch) | |
tree | eaf2953ebb1619f2569ed063855af3e32a3bda99 /ext/fg/js/client.js | |
parent | 22cbafb7b731be5cc70dbd0b0ad3372e8efdc1f0 (diff) |
More cleanup
Diffstat (limited to 'ext/fg/js/client.js')
-rw-r--r-- | ext/fg/js/client.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js index 11190869..e7300874 100644 --- a/ext/fg/js/client.js +++ b/ext/fg/js/client.js @@ -37,9 +37,9 @@ class Client { window.addEventListener('scroll', (e) => this.hidePopup()); window.addEventListener('resize', (e) => this.hidePopup()); - getOptions((opts) => { + bgGetOptions((opts) => { this.setOptions(opts); - getState((state) => this.setEnabled(state === 'enabled')); + bgGetState((state) => this.setEnabled(state === 'enabled')); }); } @@ -101,19 +101,21 @@ class Client { } range.setLength(this.options.scanLength); - findTerm(range.text(), ({definitions, length}) => { + bgFindTerm(range.text(), ({definitions, length}) => { if (length === 0) { this.hidePopup(); } else { range.setLength(length); - renderText( + bgRenderText( {defs: definitions, root: this.fgRoot, options: this.options}, 'term-list.html', (content) => { this.definitions = definitions; this.showPopup(range, content); - canAddNotes(definitions, (states) => { - states.forEach((state, index) => this.popup.sendMessage('setActionState', {index: index, state: state})); + bgCanAddNotes(definitions, (states) => { + if (states !== null) { + states.forEach((state, index) => this.popup.sendMessage('setActionState', {index: index, state: state})); + } }); } ); @@ -129,8 +131,8 @@ class Client { } actionDisplayKanji(kanji) { - findKanji(kanji, (definitions) => { - renderText( + bgFindKanji(kanji, (definitions) => { + bgRenderText( {defs: definitions, root: this.fgRoot, options: this.options}, 'kanji-list.html', (content) => { |