summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-05-24 20:29:50 -0700
committerAlex Yatskov <alex@foosoft.net>2017-05-24 20:29:50 -0700
commit867f7dd24f21c3cb11642290a78507bd7012de52 (patch)
tree850d9d11761f37892c529db6742fee742baa717a
parent0efab9773d0cc6586eb4a1f271821795b6d07f5c (diff)
make soft katakana search be implicit
-rw-r--r--ext/bg/js/options.js2
-rw-r--r--ext/bg/js/translator.js12
-rw-r--r--ext/bg/js/util.js1
-rw-r--r--ext/bg/js/yomichan.js2
-rw-r--r--ext/bg/options.html6
5 files changed, 8 insertions, 15 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 4eafd9ef..1bd106d8 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -29,7 +29,6 @@ function formRead() {
optionsNew.general.audioSource = $('#audio-playback-source').val();
optionsNew.general.audioVolume = $('#audio-playback-volume').val();
optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
- optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked');
optionsNew.general.debugInfo = $('#show-debug-info').prop('checked');
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
optionsNew.general.maxResults = parseInt($('#max-displayed-results').val(), 10);
@@ -127,7 +126,6 @@ $(document).ready(() => {
$('#audio-playback-source').val(options.general.audioSource);
$('#audio-playback-volume').val(options.general.audioVolume);
$('#group-terms-results').prop('checked', options.general.groupResults);
- $('#soft-katakana-search').prop('checked', options.general.softKatakana);
$('#show-debug-info').prop('checked', options.general.debugInfo);
$('#show-advanced-options').prop('checked', options.general.showAdvanced);
$('#max-displayed-results').val(options.general.maxResults);
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index b3b90641..8d65a0cd 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -41,7 +41,7 @@ class Translator {
});
}
- findTerms(text, dictionaries, softKatakana, alphanumeric) {
+ findTerms(text, dictionaries, alphanumeric) {
const titles = Object.keys(dictionaries);
const cache = {};
@@ -54,10 +54,10 @@ class Translator {
return this.findTermsDeinflected(text, titles, cache).then(deinfLiteral => {
const textHiragana = wanakana._katakanaToHiragana(text);
- if (text !== textHiragana && softKatakana) {
- return this.findTermsDeinflected(textHiragana, titles, cache).then(deinfHiragana => deinfLiteral.concat(deinfHiragana));
- } else {
+ if (text === textHiragana) {
return deinfLiteral;
+ } else {
+ return this.findTermsDeinflected(textHiragana, titles, cache).then(deinfHiragana => deinfLiteral.concat(deinfHiragana));
}
}).then(deinflections => {
let definitions = [];
@@ -91,8 +91,8 @@ class Translator {
});
}
- findTermsGrouped(text, dictionaries, softKatakana, alphanumeric) {
- return this.findTerms(text, dictionaries, softKatakana, alphanumeric).then(({length, definitions}) => {
+ findTermsGrouped(text, dictionaries, alphanumeric) {
+ return this.findTerms(text, dictionaries, alphanumeric).then(({length, definitions}) => {
return {length, definitions: dictTermsGroup(definitions, dictionaries)};
});
}
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 593e7d03..6e97b0ea 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -98,7 +98,6 @@ function optionsSetDefaults(options) {
audioSource: 'jpod101',
audioVolume: 100,
groupResults: true,
- softKatakana: true,
debugInfo: false,
maxResults: 32,
showAdvanced: false,
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 7be67d01..b4beb179 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -111,7 +111,7 @@ window.yomichan = new class {
this.translator.findTermsGrouped.bind(this.translator) :
this.translator.findTerms.bind(this.translator);
- return searcher(text, dictEnabledSet(this.options), this.options.general.softKatakana, this.options.scanning.alphanumeric).then(({definitions, length}) => {
+ return searcher(text, dictEnabledSet(this.options), this.options.scanning.alphanumeric).then(({definitions, length}) => {
return {length, definitions: definitions.slice(0, this.options.general.maxResults)};
});
}
diff --git a/ext/bg/options.html b/ext/bg/options.html
index 8281c317..7bddad67 100644
--- a/ext/bg/options.html
+++ b/ext/bg/options.html
@@ -39,10 +39,6 @@
</div>
<div class="checkbox options-advanced">
- <label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label>
- </div>
-
- <div class="checkbox options-advanced">
<label><input type="checkbox" id="show-debug-info"> Show debug information</label>
</div>
@@ -66,7 +62,7 @@
</div>
<div class="form-group options-advanced">
- <label>Popup size (width x height, in pixels)</label>
+ <label>Popup size (width &times; height, in pixels)</label>
<div class="row">
<div class="col-xs-6"><input type="number" min="1" id="popup-width" class="form-control"></div>
<div class="col-xs-6"><input type="number" min="1" id="popup-height" class="form-control"></div>