From de299c64ae0d32f316d1679b79dd1ad72e1c0ed9 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 24 Nov 2020 11:54:08 -0500 Subject: Display updates (#1057) * Fix history assignment on the search page * Use clear instead of assigned * Simplify definitions assignment * Organize * Fix query not being cleared * Fix media loading * Fix potential issue with options not being assigned * Catch error when frameId is null, causing infinite loop * Fix frontend construction parameters --- ext/bg/js/search.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 476370bf..effa31bc 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -143,7 +143,7 @@ class DisplaySearch extends Display { await this.updateOptions(); const query = this._queryInput.value; if (query) { - this._search(false); + this._search(false, false); } } @@ -153,7 +153,7 @@ class DisplaySearch extends Display { switch (type) { case 'terms': case 'kanji': - animate = content.animate; + animate = !!content.animate; valid = content.definitions.length > 0; this.blurElement(this._queryInput); break; @@ -182,12 +182,12 @@ class DisplaySearch extends Display { e.preventDefault(); e.stopImmediatePropagation(); this.blurElement(e.currentTarget); - this._search(true); + this._search(true, true); } _onSearch(e) { e.preventDefault(); - this._search(true); + this._search(true, true); } _onCopy() { @@ -197,7 +197,7 @@ class DisplaySearch extends Display { _onExternalSearchUpdate({text, animate=true}) { this._queryInput.value = text; - this._search(animate); + this._search(animate, false); } _onWanakanaEnableChange(e) { @@ -342,11 +342,11 @@ class DisplaySearch extends Display { }); } - _search(animate) { + _search(animate, history) { const query = this._queryInput.value; const details = { focus: false, - history: false, + history, params: { query }, -- cgit v1.2.3