aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-04 17:32:58 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-05 19:57:37 +0300
commite4fc53480f36b56abba0ab1cb20f6aad7bf4a004 (patch)
tree5fc450d75535aa0ecdfacbc5204a0fc532f34f23 /ext/fg/js/frontend.js
parent668be6224b5db22e6c55afbb4bc676b7d1a149d9 (diff)
move broadcastRootPopupInformation to Frontend
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index c160b9e3..4e9d474c 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -18,6 +18,7 @@
/* global
* TextScanner
+ * apiForward
* apiGetZoom
* apiKanjiFind
* apiOptionsGet
@@ -53,7 +54,7 @@ class Frontend extends TextScanner {
this._runtimeMessageHandlers = new Map([
['popupSetVisibleOverride', ({visible}) => { this.popup.setVisibleOverride(visible); }],
- ['rootPopupRequestInformationBroadcast', () => { this.popup.broadcastRootPopupInformation(); }]
+ ['rootPopupRequestInformationBroadcast', () => { this._broadcastRootPopupInformation(); }]
]);
}
@@ -77,7 +78,7 @@ class Frontend extends TextScanner {
chrome.runtime.onMessage.addListener(this.onRuntimeMessage.bind(this));
this._updateContentScale();
- this.popup.broadcastRootPopupInformation();
+ this._broadcastRootPopupInformation();
} catch (e) {
this.onError(e);
}
@@ -257,6 +258,12 @@ class Frontend extends TextScanner {
this._updatePopupPosition();
}
+ _broadcastRootPopupInformation() {
+ if (!this.popup.isProxy() && this.popup.depth === 0) {
+ apiForward('rootPopupInformation', {popupId: this.popup.id, frameId: this.popup.frameId});
+ }
+ }
+
async _updatePopupPosition() {
const textSource = this.getCurrentTextSource();
if (textSource !== null && await this.popup.isVisible()) {