aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-12 14:34:45 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-12 15:31:29 -0400
commit194615ef21557236cd2b9ea390b4164a4d5338c5 (patch)
tree46bd7a3c8399c7f372a680182bb2328dfe65dc47
parent3e249e19ac5f5650553c6303b87adfdb2a688536 (diff)
Make popups store options
-rw-r--r--ext/fg/js/frontend.js1
-rw-r--r--ext/fg/js/popup-proxy-host.js6
-rw-r--r--ext/fg/js/popup-proxy.js5
-rw-r--r--ext/fg/js/popup.js5
4 files changed, 17 insertions, 0 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 1c41cad1..f67441af 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -287,6 +287,7 @@ class Frontend {
async updateOptions() {
this.options = await apiOptionsGet(this.getOptionsContext());
this.setEnabled(this.options.general.enable);
+ await this.popup.setOptions(this.options);
}
popupTimerSet(callback) {
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index f933639c..5edee8dd 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -38,6 +38,7 @@ class PopupProxyHost {
this.apiReceiver = new FrontendApiReceiver(`popup-proxy-host#${frameId}`, {
createNestedPopup: ({parentId}) => this.createNestedPopup(parentId),
+ setOptions: ({id, options}) => this.setOptions(id, options),
show: ({id, elementRect, options}) => this.show(id, elementRect, options),
showOrphaned: ({id, elementRect, options}) => this.show(id, elementRect, options),
hide: ({id, changeFocus}) => this.hide(id, changeFocus),
@@ -86,6 +87,11 @@ class PopupProxyHost {
return new DOMRect(x, y, jsonRect.width, jsonRect.height);
}
+ async setOptions(id, options) {
+ const popup = this.getPopup(id);
+ return await popup.setOptions(options);
+ }
+
async show(id, elementRect, options) {
const popup = this.getPopup(id);
elementRect = this.jsonRectToDOMRect(popup, elementRect);
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index efbd28b2..22b95785 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -46,6 +46,11 @@ class PopupProxy {
return id;
}
+ async setOptions(options) {
+ const id = await this.getPopupId();
+ return await this.invokeHostApi('setOptions', {id, options});
+ }
+
async show(elementRect, options) {
const id = await this.getPopupId();
elementRect = PopupProxy.DOMRectToJson(elementRect);
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 0fd6a9d0..396a5be9 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -37,6 +37,7 @@ class Popup {
this.isInjected = false;
this.visible = false;
this.visibleOverride = null;
+ this.options = null;
this.updateVisibility();
}
@@ -78,6 +79,10 @@ class Popup {
});
}
+ async setOptions(options) {
+ this.options = options;
+ }
+
async show(elementRect, writingMode, options) {
await this.inject(options);