From ad90bad05782d275970a196817802ca9c7b6e735 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 29 Dec 2020 23:38:44 -0500 Subject: Display profile panel (#1178) * Expose Display.displayGenerator * Update search when assigning options context * Don't clear selection unless the popup changes * Merge search styles * Create panel for changing the profile --- ext/fg/js/float-main.js | 3 +++ ext/fg/js/frontend.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'ext/fg/js') diff --git a/ext/fg/js/float-main.js b/ext/fg/js/float-main.js index aee736a2..a8b3d1b0 100644 --- a/ext/fg/js/float-main.js +++ b/ext/fg/js/float-main.js @@ -17,6 +17,7 @@ /* global * Display + * DisplayProfileSelection * DocumentFocusController * JapaneseUtil * api @@ -33,6 +34,8 @@ const japaneseUtil = new JapaneseUtil(null); const display = new Display('popup', japaneseUtil, documentFocusController); await display.prepare(); + const displayProfileSelection = new DisplayProfileSelection(display); + displayProfileSelection.prepare(); display.initializeState(); yomichan.ready(); diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index cb105341..c9b30d8b 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -349,6 +349,8 @@ class Frontend { const {usePopupWindow, showIframePopupsInRootFrame} = this._options.general; const isIframe = !this._useProxyPopup && (window !== window.parent); + const currentPopup = this._popup; + let popupPromise; if (usePopupWindow) { popupPromise = this._popupCache.get('window'); @@ -393,7 +395,10 @@ class Frontend { } if (this._updatePopupToken !== token) { return; } - this._clearSelection(true); + if (popup !== currentPopup) { + this._clearSelection(true); + } + this._popupEventListeners.removeAllEventListeners(); this._popup = popup; if (popup !== null) { -- cgit v1.2.3