diff options
Diffstat (limited to 'ext/bg/js/search.js')
| -rw-r--r-- | ext/bg/js/search.js | 16 | 
1 files changed, 15 insertions, 1 deletions
| diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 5be71555..b3e3ebca 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -40,7 +40,6 @@ class DisplaySearch extends Display {          });          this._queryParser = new QueryParser({              getOptionsContext: this.getOptionsContext.bind(this), -            setContent: this.setContent.bind(this),              setSpinnerVisible: this.setSpinnerVisible.bind(this)          });          this._onKeyDownIgnoreKeys = new Map([ @@ -67,6 +66,9 @@ class DisplaySearch extends Display {          await this.updateOptions();          yomichan.on('optionsUpdated', () => this.updateOptions());          await this._queryParser.prepare(); + +        this._queryParser.on('searched', this._onQueryParserSearch.bind(this)); +          const options = this.getOptions();          const {queryParams: {query='', mode=''}} = parseUrl(window.location.href); @@ -169,6 +171,18 @@ class DisplaySearch extends Display {      // Private +    _onQueryParserSearch({type, definitions, sentence, cause}) { +        this.setContent(type, { +            definitions, +            context: { +                focus: false, +                disableHistory: cause === 'mouse', +                sentence, +                url: window.location.href +            } +        }); +    } +      _onSearchInput() {          this._updateSearchButton(); |