summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-proxy-host.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-19 17:46:05 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-05 19:57:37 +0300
commitd20ece9f074bb9d241a902f29344e5906e3c8210 (patch)
treec496984fabf674081dc1360ea5c34bbae22e50c8 /ext/fg/js/popup-proxy-host.js
parent09151a1a860f35b8dcbdbe9a25c09be5abeb4e37 (diff)
move frame offset forwarding code to a class
Diffstat (limited to 'ext/fg/js/popup-proxy-host.js')
-rw-r--r--ext/fg/js/popup-proxy-host.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index 487dda90..4b136e41 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -19,7 +19,6 @@
/* global
* FrontendApiReceiver
* Popup
- * apiForward
* apiFrameInformationGet
*/
@@ -49,12 +48,6 @@ class PopupProxyHost {
['clearAutoPlayTimer', this._onApiClearAutoPlayTimer.bind(this)],
['setContentScale', this._onApiSetContentScale.bind(this)]
]));
-
- this._windowMessageHandlers = new Map([
- ['getIframeOffset', ({offset, uniqueId}, e) => { return this._onGetIframeOffset(offset, uniqueId, e); }]
- ]);
-
- window.addEventListener('message', this.onMessage.bind(this), false);
}
getOrCreatePopup(id=null, parentId=null, depth=null) {
@@ -159,30 +152,6 @@ class PopupProxyHost {
return popup.setContentScale(scale);
}
- // Window message handlers
-
- onMessage(e) {
- const {action, params} = e.data;
- const handler = this._windowMessageHandlers.get(action);
- if (typeof handler !== 'function') { return; }
- handler(params, e);
- }
-
- _onGetIframeOffset(offset, uniqueId, e) {
- let sourceIframe = null;
- for (const iframe of document.querySelectorAll('iframe:not(.yomichan-float)')) {
- if (iframe.contentWindow !== e.source) { continue; }
- sourceIframe = iframe;
- break;
- }
- if (sourceIframe === null) { return; }
-
- const [forwardedX, forwardedY] = offset;
- const {x, y} = sourceIframe.getBoundingClientRect();
- offset = [forwardedX + x, forwardedY + y];
- apiForward('iframeOffset', {offset, uniqueId});
- }
-
// Private functions
_getPopup(id) {