aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background/backend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-28 14:18:18 -0500
committerGitHub <noreply@github.com>2021-02-28 14:18:18 -0500
commit4806414f957ca324fad7d152ef04e34602a7bdbd (patch)
tree77e28414d19a5a417a208ea13e1a1d492c2404a3 /ext/js/background/backend.js
parent6f76645f4cf0005ddb1022406fdf259a5117ce26 (diff)
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
Diffstat (limited to 'ext/js/background/backend.js')
-rw-r--r--ext/js/background/backend.js7
1 files changed, 6 insertions, 1 deletions
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) {