diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2019-11-08 00:49:20 +0200 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2019-11-23 17:45:44 +0200 |
commit | c1d24208d383e687f443c4e7dfc7bfda81d191bd (patch) | |
tree | 4be76fa658df160e1eca35832a81bb547e071b59 /ext/bg/js/settings.js | |
parent | 955e131f9673e006556bc2c5e0b3551a614ccc48 (diff) |
start mecab only after enabling the setting
Diffstat (limited to 'ext/bg/js/settings.js')
-rw-r--r-- | ext/bg/js/settings.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index f4fe032a..0013291a 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -154,6 +154,7 @@ async function formWrite(options) { function formSetupEventListeners() { $('input, select, textarea').not('.anki-model').not('.ignore-form-changes *').change(utilAsync(onFormOptionsChanged)); + $('#parsing-mecab-enable').change(onParseMecabChanged); $('.anki-model').change(utilAsync(onAnkiModelChanged)); } @@ -441,6 +442,20 @@ function onMessage({action, params}, sender, callback) { /* + * Text parsing + */ + +function onParseMecabChanged(e) { + const mecab = utilBackend().mecab; + if (e.target.checked) { + mecab.startListener(); + } else { + mecab.stopListener(); + } +} + + +/* * Anki */ |