aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/driver.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-08 15:33:45 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-08 15:33:45 -0800
commit148291d3a7cea096317c1c8d22f06f6e18cfdcfb (patch)
tree7ac7bb03cc980d3c1bd6cbdb84f6a8b6851012b9 /ext/fg/js/driver.js
parent0498ea5d361867f34b6b813178a39709e8bea68e (diff)
WIP
Diffstat (limited to 'ext/fg/js/driver.js')
-rw-r--r--ext/fg/js/driver.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index c0e328d5..12003d55 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -146,7 +146,14 @@ class Driver {
searchTerms(textSource) {
textSource.setEndOffset(this.options.scanLength);
- return findTerm(textSource.text()).then(({definitions, length}) => {
+ let findFunc = findTerm;
+ let showFunc = this.popup.showTermDefs.bind(this.popup);
+ if (this.options.groupTermResults) {
+ findFunc = findTermGrouped;
+ showFunc = this.popup.showTermGroupedDefs.bind(this.popup);
+ }
+
+ return findFunc(textSource.text()).then(({definitions, length}) => {
if (definitions.length === 0) {
return false;
} else {
@@ -159,7 +166,7 @@ class Driver {
});
this.popup.showNextTo(textSource.getRect());
- this.popup.showTermDefs(definitions, this.options);
+ showFunc(definitions, this.options);
this.lastTextSource = textSource;
if (this.options.selectMatchedText) {
textSource.select();