From c26c4ae0cb2e8516d79e827e7f76a5974fffdae4 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 16 Aug 2020 16:16:18 -0400 Subject: Frontend initialization refactor (#737) * Fix incorrect popup depth reassignment * Rename variable * Rename property * Use explicit parameter values * Refactor setupNestedPopups * Refactor frontend initialization --- ext/fg/js/float.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ext/fg/js/float.js') 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); -- cgit v1.2.3