summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/frontend.js43
-rw-r--r--ext/fg/js/source.js11
2 files changed, 32 insertions, 22 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) {
diff --git a/ext/fg/js/source.js b/ext/fg/js/source.js
index 38810f07..70f14179 100644
--- a/ext/fg/js/source.js
+++ b/ext/fg/js/source.js
@@ -32,6 +32,14 @@ class TextSourceRange {
this.imposterSourceElement = imposterSourceElement;
}
+ get startOffset() {
+ return this.range.startOffset;
+ }
+
+ get endOffset() {
+ return this.range.endOffset;
+ }
+
clone() {
return new TextSourceRange(this.range.cloneRange(), this.content, this.imposterContainer, this.imposterSourceElement);
}
@@ -230,8 +238,7 @@ class TextSourceElement {
other instanceof TextSourceElement &&
this._element === other.element &&
this._fullContent === other.fullContent &&
- this._startOffset === other.startOffset &&
- this._endOffset === other.endOffset
+ this._startOffset === other.startOffset
);
}