From 4806414f957ca324fad7d152ef04e34602a7bdbd Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 28 Feb 2021 14:18:18 -0500 Subject: Text source element scanning improvements (#1464) * Add api.textHasJapaneseCharacters * Add support for empty query * Add support for showing the query parser for TextSourceElement with content that does not start with Japanese text --- ext/js/display/display.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/js/display') diff --git a/ext/js/display/display.js b/ext/js/display/display.js index ad9a25b4..8b521d21 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -543,7 +543,7 @@ class Display extends EventDispatcher { case 'kanji': { let query = urlSearchParams.get('query'); - if (!query) { break; } + if (query === null) { break; } this._query = query; clear = false; @@ -882,7 +882,7 @@ class Display extends EventDispatcher { let {definitions} = content; if (!Array.isArray(definitions)) { - definitions = lookup ? await this._findDefinitions(isTerms, query, wildcardsEnabled, optionsContext) : []; + definitions = lookup && query.length > 0 ? await this._findDefinitions(isTerms, query, wildcardsEnabled, optionsContext) : []; if (this._setContentToken !== token) { return; } content.definitions = definitions; changeHistory = true; -- cgit v1.2.3