diff options
| author | Alex Yatskov <alex@foosoft.net> | 2016-03-27 18:24:04 -0700 | 
|---|---|---|
| committer | Alex Yatskov <alex@foosoft.net> | 2016-03-27 18:24:04 -0700 | 
| commit | 2bdb5763780e68889b355200a60844da83d3ede7 (patch) | |
| tree | 11138675c85db464b91446a3e5e1f2b74e9d9153 /ext/client.js | |
| parent | 70faa9e87f742b5a883762c8f40b3e4a5a3f3609 (diff) | |
Better output
Diffstat (limited to 'ext/client.js')
| -rw-r--r-- | ext/client.js | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/client.js b/ext/client.js index 803f7db6..85a4ba64 100644 --- a/ext/client.js +++ b/ext/client.js @@ -48,7 +48,15 @@ class Client {              return;          } -        this.showPopup(range); +        findTerm(range.toString(), ({results, length}) => { +            if (length === 0) { +                this.hidePopup(); +            } else { +                range.setEnd(range.endContainer, range.startOffset + length); +                this.popup.html(renderDefs(results.slice(0, 5))); +                this.showPopup(range); +            } +        });      }      onMessage(request, sender, callback) {  |