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/background/backend.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/js/background') diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index 484473c7..3d8c4c4a 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -127,7 +127,8 @@ class Backend { ['getOrCreateSearchPopup', {async: true, contentScript: true, handler: this._onApiGetOrCreateSearchPopup.bind(this)}], ['isTabSearchPopup', {async: true, contentScript: true, handler: this._onApiIsTabSearchPopup.bind(this)}], ['triggerDatabaseUpdated', {async: false, contentScript: true, handler: this._onApiTriggerDatabaseUpdated.bind(this)}], - ['testMecab', {async: true, contentScript: true, handler: this._onApiTestMecab.bind(this)}] + ['testMecab', {async: true, contentScript: true, handler: this._onApiTestMecab.bind(this)}], + ['textHasJapaneseCharacters', {async: false, contentScript: true, handler: this._onApiTextHasJapaneseCharacters.bind(this)}] ]); this._messageHandlersWithProgress = new Map([ ]); @@ -727,6 +728,10 @@ class Backend { return true; } + _onApiTextHasJapaneseCharacters({text}) { + return this._japaneseUtil.isStringPartiallyJapanese(text); + } + // Command handlers async _onCommandOpenSearchPage(params) { -- cgit v1.2.3