diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2020-01-25 02:57:57 +0200 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2020-01-25 02:57:57 +0200 |
commit | fa4004437d8ca5aff34c31f61ce8aea485be24d1 (patch) | |
tree | ebe85023c8a5e5efbb8ec708699118b32ac61e87 | |
parent | aa5a044dade6a6b4caaa368215b96add53a312b4 (diff) |
query parser: add toggle for term spacing
-rw-r--r-- | ext/bg/data/options-schema.json | 5 | ||||
-rw-r--r-- | ext/bg/js/search-query-parser.js | 5 | ||||
-rw-r--r-- | ext/bg/js/settings/main.js | 1 | ||||
-rw-r--r-- | ext/bg/settings.html | 4 | ||||
-rw-r--r-- | ext/mixed/css/display.css | 2 |
5 files changed, 16 insertions, 1 deletions
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 @@ <label><input type="checkbox" id="parsing-mecab-enable"> Enable text parsing using MeCab</label> </div> + <div class="checkbox"> + <label><input type="checkbox" id="parsing-term-spacing"> Enable small spaces between parsed words</label> + </div> + <div class="form-group"> <label for="parsing-reading-mode">Reading mode</label> <select class="form-control" id="parsing-reading-mode"> diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css index ea0eb260..add2583e 100644 --- a/ext/mixed/css/display.css +++ b/ext/mixed/css/display.css @@ -132,7 +132,7 @@ html:root[data-yomichan-page=float] .navigation-header:not([hidden])~.navigation font-size: 2em; } -.query-parser-term { +#query-parser[data-term-spacing=true] .query-parser-term { margin-right: 0.2em; } |