From 983e2c79361ad15ada6aae0d153fef9f1b867a93 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 11 Jan 2021 23:13:35 -0500 Subject: Refactor text scanner options context generation (#1225) * Refactor how options context is created and updated * Udpate TextScanner/QueryParser to use getSearchContext instead of getOptionsContext --- ext/fg/js/frontend.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext/fg') diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 4ca7874a..e6f72689 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -54,7 +54,7 @@ class Frontend { node: window, ignoreElements: this._ignoreElements.bind(this), ignorePoint: this._ignorePoint.bind(this), - getOptionsContext: this._getOptionsContext.bind(this), + getSearchContext: this._getSearchContext.bind(this), documentUtil: this._documentUtil, searchTerms: true, searchKanji: true @@ -615,6 +615,10 @@ class Frontend { } async _getOptionsContext() { + return (await this._getSearchContext()).optionsContext; + } + + async _getSearchContext() { if (this._optionsContextOverride !== null) { return this._optionsContextOverride; } @@ -629,6 +633,6 @@ class Frontend { } const depth = this._depth; - return {depth, url}; + return {optionsContext: {depth, url}}; } } -- cgit v1.2.3