aboutsummaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/float.js4
-rw-r--r--ext/fg/js/frontend.js5
-rw-r--r--ext/fg/js/popup-proxy-host.js18
-rw-r--r--ext/fg/js/popup-proxy.js12
-rw-r--r--ext/fg/js/popup.js30
5 files changed, 33 insertions, 36 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index d9b483d7..4a571466 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -143,8 +143,8 @@ DisplayFloat.onKeyDownHandlers = {
};
DisplayFloat.messageHandlers = {
- termsShow: (self, {definitions, options, context}) => self.termsShow(definitions, options, context),
- kanjiShow: (self, {definitions, options, context}) => self.kanjiShow(definitions, options, context),
+ termsShow: (self, {definitions, context}) => self.termsShow(definitions, context),
+ kanjiShow: (self, {definitions, context}) => self.kanjiShow(definitions, context),
clearAutoPlayTimer: (self) => self.clearAutoPlayTimer(),
orphaned: (self) => self.onOrphaned(),
initialize: (self, {options, popupInfo, url, childrenSupported}) => self.initialize(options, popupInfo, url, childrenSupported)
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index f67441af..52a23889 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -333,8 +333,7 @@ class Frontend {
if (textSource && this.options.scanning.modifier !== 'none') {
this.popup.showOrphaned(
textSource.getRect(),
- textSource.getWritingMode(),
- this.options
+ textSource.getWritingMode()
);
}
} else {
@@ -374,7 +373,6 @@ class Frontend {
textSource.getRect(),
textSource.getWritingMode(),
definitions,
- this.options,
{sentence, url, focus}
);
@@ -405,7 +403,6 @@ class Frontend {
textSource.getRect(),
textSource.getWritingMode(),
definitions,
- this.options,
{sentence, url, focus}
);
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index c3acec7f..74a5153a 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -39,12 +39,12 @@ class PopupProxyHost {
this.apiReceiver = new FrontendApiReceiver(`popup-proxy-host#${frameId}`, {
createNestedPopup: ({parentId}) => this.createNestedPopup(parentId),
setOptions: ({id, options}) => this.setOptions(id, options),
- showOrphaned: ({id, elementRect, options}) => this.showOrphaned(id, elementRect, options),
+ showOrphaned: ({id, elementRect}) => this.showOrphaned(id, elementRect),
hide: ({id, changeFocus}) => this.hide(id, changeFocus),
setVisibleOverride: ({id, visible}) => this.setVisibleOverride(id, visible),
containsPoint: ({id, x, y}) => this.containsPoint(id, x, y),
- termsShow: ({id, elementRect, writingMode, definitions, options, context}) => this.termsShow(id, elementRect, writingMode, definitions, options, context),
- kanjiShow: ({id, elementRect, writingMode, definitions, options, context}) => this.kanjiShow(id, elementRect, writingMode, definitions, options, context),
+ termsShow: ({id, elementRect, writingMode, definitions, context}) => this.termsShow(id, elementRect, writingMode, definitions, context),
+ kanjiShow: ({id, elementRect, writingMode, definitions, context}) => this.kanjiShow(id, elementRect, writingMode, definitions, context),
clearAutoPlayTimer: ({id}) => this.clearAutoPlayTimer(id)
});
}
@@ -91,10 +91,10 @@ class PopupProxyHost {
return await popup.setOptions(options);
}
- async showOrphaned(id, elementRect, options) {
+ async showOrphaned(id, elementRect) {
const popup = this.getPopup(id);
elementRect = this.jsonRectToDOMRect(popup, elementRect);
- return await popup.showOrphaned(elementRect, options);
+ return await popup.showOrphaned(elementRect);
}
async hide(id, changeFocus) {
@@ -112,18 +112,18 @@ class PopupProxyHost {
return await popup.containsPoint(x, y);
}
- async termsShow(id, elementRect, writingMode, definitions, options, context) {
+ async termsShow(id, elementRect, writingMode, definitions, context) {
const popup = this.getPopup(id);
elementRect = this.jsonRectToDOMRect(popup, elementRect);
if (!PopupProxyHost.popupCanShow(popup)) { return false; }
- return await popup.termsShow(elementRect, writingMode, definitions, options, context);
+ return await popup.termsShow(elementRect, writingMode, definitions, context);
}
- async kanjiShow(id, elementRect, writingMode, definitions, options, context) {
+ async kanjiShow(id, elementRect, writingMode, definitions, context) {
const popup = this.getPopup(id);
elementRect = this.jsonRectToDOMRect(popup, elementRect);
if (!PopupProxyHost.popupCanShow(popup)) { return false; }
- return await popup.kanjiShow(elementRect, writingMode, definitions, options, context);
+ return await popup.kanjiShow(elementRect, writingMode, definitions, context);
}
async clearAutoPlayTimer(id) {
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index 96fc8890..e8d6bc98 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -51,10 +51,10 @@ class PopupProxy {
return await this.invokeHostApi('setOptions', {id, options});
}
- async showOrphaned(elementRect, options) {
+ async showOrphaned(elementRect) {
const id = await this.getPopupId();
elementRect = PopupProxy.DOMRectToJson(elementRect);
- return await this.invokeHostApi('showOrphaned', {id, elementRect, options});
+ return await this.invokeHostApi('showOrphaned', {id, elementRect});
}
async hide(changeFocus) {
@@ -76,16 +76,16 @@ class PopupProxy {
return await this.invokeHostApi('containsPoint', {id: this.id, x, y});
}
- async termsShow(elementRect, writingMode, definitions, options, context) {
+ async termsShow(elementRect, writingMode, definitions, context) {
const id = await this.getPopupId();
elementRect = PopupProxy.DOMRectToJson(elementRect);
- return await this.invokeHostApi('termsShow', {id, elementRect, writingMode, definitions, options, context});
+ return await this.invokeHostApi('termsShow', {id, elementRect, writingMode, definitions, context});
}
- async kanjiShow(elementRect, writingMode, definitions, options, context) {
+ async kanjiShow(elementRect, writingMode, definitions, context) {
const id = await this.getPopupId();
elementRect = PopupProxy.DOMRectToJson(elementRect);
- return await this.invokeHostApi('kanjiShow', {id, elementRect, writingMode, definitions, options, context});
+ return await this.invokeHostApi('kanjiShow', {id, elementRect, writingMode, definitions, context});
}
async clearAutoPlayTimer() {
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index a9fde7b6..f36bb436 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -41,14 +41,14 @@ class Popup {
this.updateVisibility();
}
- inject(options) {
+ inject() {
if (this.injectPromise === null) {
- this.injectPromise = this.createInjectPromise(options);
+ this.injectPromise = this.createInjectPromise();
}
return this.injectPromise;
}
- async createInjectPromise(options) {
+ async createInjectPromise() {
try {
const {frameId} = await this.frameIdPromise;
if (typeof frameId === 'number') {
@@ -62,7 +62,7 @@ class Popup {
const parentFrameId = (typeof this.frameId === 'number' ? this.frameId : null);
this.container.addEventListener('load', () => {
this.invokeApi('initialize', {
- options: options,
+ options: this.options,
popupInfo: {
id: this.id,
depth: this.depth,
@@ -87,10 +87,10 @@ class Popup {
this.options = options;
}
- async show(elementRect, writingMode, options) {
- await this.inject(options);
+ async show(elementRect, writingMode) {
+ await this.inject();
- const optionsGeneral = options.general;
+ const optionsGeneral = this.options.general;
const container = this.container;
const containerRect = container.getBoundingClientRect();
const getPosition = (
@@ -215,9 +215,9 @@ class Popup {
return [position, size, after];
}
- async showOrphaned(elementRect, writingMode, options) {
+ async showOrphaned(elementRect, writingMode) {
if (!this.isInitialized()) { return; }
- await this.show(elementRect, writingMode, options);
+ await this.show(elementRect, writingMode);
this.invokeApi('orphaned');
}
@@ -279,16 +279,16 @@ class Popup {
return false;
}
- async termsShow(elementRect, writingMode, definitions, options, context) {
+ async termsShow(elementRect, writingMode, definitions, context) {
if (!this.isInitialized()) { return; }
- await this.show(elementRect, writingMode, options);
- this.invokeApi('termsShow', {definitions, options, context});
+ await this.show(elementRect, writingMode);
+ this.invokeApi('termsShow', {definitions, context});
}
- async kanjiShow(elementRect, writingMode, definitions, options, context) {
+ async kanjiShow(elementRect, writingMode, definitions, context) {
if (!this.isInitialized()) { return; }
- await this.show(elementRect, writingMode, options);
- this.invokeApi('kanjiShow', {definitions, options, context});
+ await this.show(elementRect, writingMode);
+ this.invokeApi('kanjiShow', {definitions, context});
}
clearAutoPlayTimer() {