summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bg/data/options-schema.json7
-rw-r--r--ext/bg/js/search-query-parser.js5
-rw-r--r--ext/bg/js/settings/main.js1
-rw-r--r--ext/bg/settings.html5
-rw-r--r--ext/mixed/css/display.css2
-rw-r--r--ext/mixed/js/japanese.js2
6 files changed, 20 insertions, 2 deletions
diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json
index c65bb1e9..a20a0619 100644
--- a/ext/bg/data/options-schema.json
+++ b/ext/bg/data/options-schema.json
@@ -419,6 +419,7 @@
"enableScanningParser",
"enableMecabParser",
"selectedParser",
+ "termSpacing",
"readingMode"
],
"properties": {
@@ -434,9 +435,13 @@
"type": ["string", "null"],
"default": null
},
+ "termSpacing": {
+ "type": "boolean",
+ "default": true
+ },
"readingMode": {
"type": "string",
- "enum": ["hiragana", "katakana", "romaji"],
+ "enum": ["hiragana", "katakana", "romaji", "none"],
"default": "hiragana"
}
}
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 6dccc7e0..b2ac82f9 100644
--- a/ext/bg/js/settings/main.js
+++ b/ext/bg/js/settings/main.js
@@ -80,6 +80,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 82ec26d9..3e06d4b5 100644
--- a/ext/bg/settings.html
+++ b/ext/bg/settings.html
@@ -526,12 +526,17 @@
<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">
<option value="hiragana">ひらがな</option>
<option value="katakana">カタカナ</option>
<option value="romaji">Romaji</option>
+ <option value="none">Disabled</option>
</select>
</div>
</div>
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;
}
diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js
index 0cbaa723..0da822d7 100644
--- a/ext/mixed/js/japanese.js
+++ b/ext/mixed/js/japanese.js
@@ -209,6 +209,8 @@ function jpConvertReading(expressionFragment, readingFragment, readingMode) {
}
}
return readingFragment;
+ case 'none':
+ return null;
default:
return readingFragment;
}