From 867f7dd24f21c3cb11642290a78507bd7012de52 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 24 May 2017 20:29:50 -0700 Subject: make soft katakana search be implicit --- ext/bg/js/options.js | 2 -- ext/bg/js/translator.js | 12 ++++++------ ext/bg/js/util.js | 1 - ext/bg/js/yomichan.js | 2 +- ext/bg/options.html | 6 +----- 5 files changed, 8 insertions(+), 15 deletions(-) (limited to 'ext') 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 @@ -38,10 +38,6 @@ -
- -
-
@@ -66,7 +62,7 @@
- +
-- cgit v1.2.3