aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-08-02 18:59:35 -0400
committerGitHub <noreply@github.com>2020-08-02 18:59:35 -0400
commit1184320e3e0863c86238a68bc90dc77b3355e332 (patch)
tree1b3a88b211cb6d23b1f0119816d4a124f03f34c6 /ext/fg/js/frontend.js
parentbdcdf9b1f5430760be605a7a5e84440e324de7b5 (diff)
Button and image scanning (#705)
* Update TextSourceElement.equals check to match TextSourceRange.equals * Force full query to be visible when scanning buttons or images with more text * Update style of query parser
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js43
1 files changed, 23 insertions, 20 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 7bc104a7..685dbd28 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -20,6 +20,7 @@
* FrameOffsetForwarder
* PopupProxy
* TextScanner
+ * TextSourceElement
* api
* docSentenceExtract
*/
@@ -423,27 +424,29 @@ class Frontend {
const sentenceExtent = this._options.anki.sentenceExt;
const layoutAwareScan = this._options.scanning.layoutAwareScan;
const sentence = docSentenceExtract(textSource, sentenceExtent, layoutAwareScan);
- this._showPopupContent(
- textSource,
- optionsContext,
- {
- focus,
- history: false,
- params: {
- type,
- query: textSource.text(),
- wildcards: 'off'
- },
- state: {
- focusEntry: 0,
- sentence,
- url
- },
- content: {
- definitions
- }
+ const query = textSource.text();
+ const details = {
+ focus,
+ history: false,
+ params: {
+ type,
+ query,
+ wildcards: 'off'
+ },
+ state: {
+ focusEntry: 0,
+ sentence,
+ url
+ },
+ content: {
+ definitions
}
- );
+ };
+ if (textSource instanceof TextSourceElement && textSource.fullContent !== query) {
+ details.params.full = textSource.fullContent;
+ details.params['full-visible'] = 'true';
+ }
+ this._showPopupContent(textSource, optionsContext, details);
}
_showPopupContent(textSource, optionsContext, details=null) {