diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-03-04 11:45:55 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-03-04 11:45:55 -0800 |
commit | b1950cf47eea6e1e4713285fc883ad6c9ac043c6 (patch) | |
tree | 0b4eec95b4519770dfb91ad70f9faaf577b763ab /ext/fg | |
parent | ca6d12dd626ba8da9103525462d59f3d63927a93 (diff) |
prelim search support
Diffstat (limited to 'ext/fg')
-rw-r--r-- | ext/fg/js/driver.js | 3 | ||||
-rw-r--r-- | ext/fg/js/frame.js | 6 | ||||
-rw-r--r-- | ext/fg/js/util.js | 6 |
3 files changed, 5 insertions, 10 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js index c953481e..87cce875 100644 --- a/ext/fg/js/driver.js +++ b/ext/fg/js/driver.js @@ -139,8 +139,7 @@ class Driver { searchTerms(textSource) { textSource.setEndOffset(this.options.scanning.length); - const findFunc = this.options.general.groupResults ? bgTermsFindGrouped : bgTermsFind; - return findFunc(textSource.text()).then(({definitions, length}) => { + return bgTermsFind(textSource.text()).then(({definitions, length}) => { if (definitions.length === 0) { return false; } else { diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js index b5077531..32e227d0 100644 --- a/ext/fg/js/frame.js +++ b/ext/fg/js/frame.js @@ -36,7 +36,7 @@ class Frame { const params = { definitions, grouped: options.general.groupResults, - addable: options.ankiMethod !== 'disabled', + addable: options.anki.enabled, playback: options.general.audioPlayback }; @@ -49,7 +49,7 @@ class Frame { this.showSpinner(false); window.scrollTo(0, 0); - bgTextRender(params, 'terms.html').then(content => { + bgTextRender('terms.html', params).then(content => { $('#content').html(content); $('.action-add-note').click(this.onAddNote.bind(this)); @@ -87,7 +87,7 @@ class Frame { this.showSpinner(false); window.scrollTo(0, 0); - bgTextRender(params, 'kanji.html').then(content => { + bgTextRender('kanji.html', params).then(content => { $('#content').html(content); $('.action-add-note').click(this.onAddNote.bind(this)); diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js index 85552a31..c38112f5 100644 --- a/ext/fg/js/util.js +++ b/ext/fg/js/util.js @@ -46,15 +46,11 @@ function bgTermsFind(text) { return bgInvoke('termsFind', {text}); } -function bgTermsFindGrouped(text) { - return bgInvoke('termsFindGrouped', {text}); -} - function bgKanjiFind(text) { return bgInvoke('kanjiFind', {text}); } -function bgTextRender(data, template) { +function bgTextRender(template, data) { return bgInvoke('textRender', {data, template}); } |