summaryrefslogtreecommitdiff
path: root/ext/fg/js/float.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-08-16 16:16:18 -0400
committerGitHub <noreply@github.com>2020-08-16 16:16:18 -0400
commitc26c4ae0cb2e8516d79e827e7f76a5974fffdae4 (patch)
treef4762afe8ac9d5ffc7ada531d8b788274d683ab7 /ext/fg/js/float.js
parent90d694429029d804740d2af384ad903be48b040e (diff)
Frontend initialization refactor (#737)
* Fix incorrect popup depth reassignment * Rename variable * Rename property * Use explicit parameter values * Refactor setupNestedPopups * Refactor frontend initialization
Diffstat (limited to 'ext/fg/js/float.js')
-rw-r--r--ext/fg/js/float.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index 8a17a437..8526c9c1 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -105,8 +105,8 @@ class DisplayFloat extends Display {
await this.updateOptions();
if (childrenSupported && !this._nestedPopupsPrepared) {
- const {depth, url} = optionsContext;
- this._prepareNestedPopups(popupId, depth, frameId, url);
+ const {depth} = optionsContext;
+ this._prepareNestedPopups(depth + 1, popupId, frameId);
this._nestedPopupsPrepared = true;
}
@@ -168,13 +168,13 @@ class DisplayFloat extends Display {
body.style.fontSize = `${scale}em`;
}
- async _prepareNestedPopups(id, depth, parentFrameId, url) {
+ async _prepareNestedPopups(depth, parentPopupId, parentFrameId) {
let complete = false;
const onOptionsUpdated = async () => {
const optionsContext = this.getOptionsContext();
const options = await api.optionsGet(optionsContext);
- const maxPopupDepthExceeded = !(typeof depth === 'number' && depth < options.scanning.popupNestingMaxDepth);
+ const maxPopupDepthExceeded = !(typeof depth === 'number' && depth <= options.scanning.popupNestingMaxDepth);
if (maxPopupDepthExceeded || complete) { return; }
complete = true;
@@ -182,11 +182,10 @@ class DisplayFloat extends Display {
try {
await this.setupNestedPopups({
- id,
depth,
+ parentPopupId,
parentFrameId,
- url,
- proxy: true
+ useProxyPopup: true
});
} catch (e) {
yomichan.logError(e);