From fa4004437d8ca5aff34c31f61ce8aea485be24d1 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sat, 25 Jan 2020 02:57:57 +0200 Subject: query parser: add toggle for term spacing --- ext/bg/data/options-schema.json | 5 +++++ ext/bg/js/search-query-parser.js | 5 +++++ ext/bg/js/settings/main.js | 1 + ext/bg/settings.html | 4 ++++ ext/mixed/css/display.css | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json index 224b93f8..d4bd3c21 100644 --- a/ext/bg/data/options-schema.json +++ b/ext/bg/data/options-schema.json @@ -381,6 +381,7 @@ "enableScanningParser", "enableMecabParser", "selectedParser", + "termSpacing", "readingMode" ], "properties": { @@ -396,6 +397,10 @@ "type": ["string", "null"], "default": null }, + "termSpacing": { + "type": "boolean", + "default": true + }, "readingMode": { "type": "string", "enum": ["hiragana", "katakana", "romaji", "none"], diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js index 8115dd46..e8e6d11f 100644 --- a/ext/bg/js/search-query-parser.js +++ b/ext/bg/js/search-query-parser.js @@ -88,6 +88,11 @@ class QueryParser extends TextScanner { ]; } + setOptions(options) { + super.setOptions(options); + this.queryParser.dataset.termSpacing = `${options.parsing.termSpacing}`; + } + refreshSelectedParser() { if (this.parseResults.length > 0) { if (this.selectedParser === null) { diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index ac255978..bed57f7d 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -74,6 +74,7 @@ async function formRead(options) { options.parsing.enableScanningParser = $('#parsing-scan-enable').prop('checked'); options.parsing.enableMecabParser = $('#parsing-mecab-enable').prop('checked'); + options.parsing.termSpacing = $('#parsing-term-spacing').prop('checked'); options.parsing.readingMode = $('#parsing-reading-mode').val(); const optionsAnkiEnableOld = options.anki.enable; diff --git a/ext/bg/settings.html b/ext/bg/settings.html index 4b73e02c..f73f79c8 100644 --- a/ext/bg/settings.html +++ b/ext/bg/settings.html @@ -451,6 +451,10 @@ +
+ +
+