make soft katakana search be implicit
This commit is contained in:
parent
0efab9773d
commit
867f7dd24f
@ -29,7 +29,6 @@ function formRead() {
|
|||||||
optionsNew.general.audioSource = $('#audio-playback-source').val();
|
optionsNew.general.audioSource = $('#audio-playback-source').val();
|
||||||
optionsNew.general.audioVolume = $('#audio-playback-volume').val();
|
optionsNew.general.audioVolume = $('#audio-playback-volume').val();
|
||||||
optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
|
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.debugInfo = $('#show-debug-info').prop('checked');
|
||||||
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
|
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
|
||||||
optionsNew.general.maxResults = parseInt($('#max-displayed-results').val(), 10);
|
optionsNew.general.maxResults = parseInt($('#max-displayed-results').val(), 10);
|
||||||
@ -127,7 +126,6 @@ $(document).ready(() => {
|
|||||||
$('#audio-playback-source').val(options.general.audioSource);
|
$('#audio-playback-source').val(options.general.audioSource);
|
||||||
$('#audio-playback-volume').val(options.general.audioVolume);
|
$('#audio-playback-volume').val(options.general.audioVolume);
|
||||||
$('#group-terms-results').prop('checked', options.general.groupResults);
|
$('#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-debug-info').prop('checked', options.general.debugInfo);
|
||||||
$('#show-advanced-options').prop('checked', options.general.showAdvanced);
|
$('#show-advanced-options').prop('checked', options.general.showAdvanced);
|
||||||
$('#max-displayed-results').val(options.general.maxResults);
|
$('#max-displayed-results').val(options.general.maxResults);
|
||||||
|
@ -41,7 +41,7 @@ class Translator {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
findTerms(text, dictionaries, softKatakana, alphanumeric) {
|
findTerms(text, dictionaries, alphanumeric) {
|
||||||
const titles = Object.keys(dictionaries);
|
const titles = Object.keys(dictionaries);
|
||||||
const cache = {};
|
const cache = {};
|
||||||
|
|
||||||
@ -54,10 +54,10 @@ class Translator {
|
|||||||
|
|
||||||
return this.findTermsDeinflected(text, titles, cache).then(deinfLiteral => {
|
return this.findTermsDeinflected(text, titles, cache).then(deinfLiteral => {
|
||||||
const textHiragana = wanakana._katakanaToHiragana(text);
|
const textHiragana = wanakana._katakanaToHiragana(text);
|
||||||
if (text !== textHiragana && softKatakana) {
|
if (text === textHiragana) {
|
||||||
return this.findTermsDeinflected(textHiragana, titles, cache).then(deinfHiragana => deinfLiteral.concat(deinfHiragana));
|
|
||||||
} else {
|
|
||||||
return deinfLiteral;
|
return deinfLiteral;
|
||||||
|
} else {
|
||||||
|
return this.findTermsDeinflected(textHiragana, titles, cache).then(deinfHiragana => deinfLiteral.concat(deinfHiragana));
|
||||||
}
|
}
|
||||||
}).then(deinflections => {
|
}).then(deinflections => {
|
||||||
let definitions = [];
|
let definitions = [];
|
||||||
@ -91,8 +91,8 @@ class Translator {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
findTermsGrouped(text, dictionaries, softKatakana, alphanumeric) {
|
findTermsGrouped(text, dictionaries, alphanumeric) {
|
||||||
return this.findTerms(text, dictionaries, softKatakana, alphanumeric).then(({length, definitions}) => {
|
return this.findTerms(text, dictionaries, alphanumeric).then(({length, definitions}) => {
|
||||||
return {length, definitions: dictTermsGroup(definitions, dictionaries)};
|
return {length, definitions: dictTermsGroup(definitions, dictionaries)};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,6 @@ function optionsSetDefaults(options) {
|
|||||||
audioSource: 'jpod101',
|
audioSource: 'jpod101',
|
||||||
audioVolume: 100,
|
audioVolume: 100,
|
||||||
groupResults: true,
|
groupResults: true,
|
||||||
softKatakana: true,
|
|
||||||
debugInfo: false,
|
debugInfo: false,
|
||||||
maxResults: 32,
|
maxResults: 32,
|
||||||
showAdvanced: false,
|
showAdvanced: false,
|
||||||
|
@ -111,7 +111,7 @@ window.yomichan = new class {
|
|||||||
this.translator.findTermsGrouped.bind(this.translator) :
|
this.translator.findTermsGrouped.bind(this.translator) :
|
||||||
this.translator.findTerms.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)};
|
return {length, definitions: definitions.slice(0, this.options.general.maxResults)};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,6 @@
|
|||||||
<label><input type="checkbox" id="show-advanced-options"> Show advanced options</label>
|
<label><input type="checkbox" id="show-advanced-options"> Show advanced options</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="checkbox options-advanced">
|
|
||||||
<label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="checkbox options-advanced">
|
<div class="checkbox options-advanced">
|
||||||
<label><input type="checkbox" id="show-debug-info"> Show debug information</label>
|
<label><input type="checkbox" id="show-debug-info"> Show debug information</label>
|
||||||
</div>
|
</div>
|
||||||
@ -66,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group options-advanced">
|
<div class="form-group options-advanced">
|
||||||
<label>Popup size (width x height, in pixels)</label>
|
<label>Popup size (width × height, in pixels)</label>
|
||||||
<div class="row">
|
<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-width" class="form-control"></div>
|
||||||
<div class="col-xs-6"><input type="number" min="1" id="popup-height" class="form-control"></div>
|
<div class="col-xs-6"><input type="number" min="1" id="popup-height" class="form-control"></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user