make soft katakana search be implicit

This commit is contained in:
Alex Yatskov 2017-05-24 20:29:50 -07:00
parent 0efab9773d
commit 867f7dd24f
5 changed files with 8 additions and 15 deletions

View File

@ -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);

View File

@ -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)};
});
}

View File

@ -98,7 +98,6 @@ function optionsSetDefaults(options) {
audioSource: 'jpod101',
audioVolume: 100,
groupResults: true,
softKatakana: true,
debugInfo: false,
maxResults: 32,
showAdvanced: false,

View File

@ -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)};
});
}

View File

@ -38,10 +38,6 @@
<label><input type="checkbox" id="show-advanced-options"> Show advanced options</label>
</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>