aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-07-18 23:47:02 -0400
committerGitHub <noreply@github.com>2020-07-18 23:47:02 -0400
commit71b97c20199e628618bed456e886a5ae7d9beb08 (patch)
treee2234eaccccdd79e7d2d45211c9668928e088f31 /ext/bg/js
parent27e05f800132a1d3a306f511c53ef03c4ddb6c49 (diff)
Display refactoring (#674)
* Move setupNestedPopups to Display * Move auto-play timer and delay into Display * Move some message handler definitions into Display * Move default optionsContext definition
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/search.js41
1 files changed, 5 insertions, 36 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index b046806e..a3741da0 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -19,11 +19,8 @@
* ClipboardMonitor
* DOM
* Display
- * Frontend
- * PopupFactory
* QueryParser
* api
- * dynamicLoader
* wanakana
*/
@@ -63,11 +60,6 @@ class DisplaySearch extends Display {
this._runtimeMessageHandlers = new Map([
['updateSearchQuery', {async: false, handler: this._onExternalSearchUpdate.bind(this)}]
]);
-
- this.setOptionsContext({
- depth: 0,
- url: window.location.href
- });
}
async prepare() {
@@ -407,7 +399,11 @@ class DisplaySearch extends Display {
yomichan.off('optionsUpdated', onOptionsUpdated);
try {
- await this._setupNestedPopups();
+ await this.setupNestedPopups({
+ depth: 1,
+ proxy: false,
+ isSearchPage: true
+ });
} catch (e) {
yomichan.logError(e);
}
@@ -417,31 +413,4 @@ class DisplaySearch extends Display {
await onOptionsUpdated();
}
-
- async _setupNestedPopups() {
- await dynamicLoader.loadScripts([
- '/mixed/js/text-scanner.js',
- '/mixed/js/frame-client.js',
- '/fg/js/frame-offset-forwarder.js',
- '/fg/js/popup.js',
- '/fg/js/popup-factory.js',
- '/fg/js/frontend.js'
- ]);
-
- const {frameId} = await api.frameInformationGet();
-
- const popupFactory = new PopupFactory(frameId);
- popupFactory.prepare();
-
- const frontend = new Frontend(
- frameId,
- popupFactory,
- {
- depth: 1,
- proxy: false,
- isSearchPage: true
- }
- );
- await frontend.prepare();
- }
}