summaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-18 21:49:55 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-02 19:33:28 -0400
commit3491affcf13ef10b78714d4955da6ee9aeb11457 (patch)
treec14b6cc396b4e1f7785323101502ad67ed204ff5 /ext/fg/js/frontend.js
parent53aad0bef68bf6930b684fda4a25e1a045cd800e (diff)
Update nested initialization parameters passed via message rather than using the URL query string
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js20
1 files changed, 3 insertions, 17 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 9c511d8a..3605dffd 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -37,23 +37,9 @@ class Frontend {
}
static create() {
- const floatUrl = chrome.extension.getURL('/fg/float.html');
- const currentUrl = location.href.replace(/[\?#][\w\W]*$/, "");
- const isNested = (currentUrl === floatUrl);
-
- let id = null;
- let parentFrameId = null;
- if (isNested) {
- let match = /[&?]id=([^&]*?)(?:&|$)/.exec(location.href);
- if (match !== null) {
- id = match[1];
- }
-
- match = /[&?]parent=(\d+)(?:&|$)/.exec(location.href);
- if (match !== null) {
- parentFrameId = parseInt(match[1], 10);
- }
- }
+ const initializationData = window.frontendInitializationData;
+ const isNested = (initializationData !== null && typeof initializationData === 'object');
+ const {id, parentFrameId} = initializationData || {};
const popup = isNested ? new PopupProxy(id, parentFrameId) : PopupProxyHost.instance.createPopup(null);
const frontend = new Frontend(popup);