diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-04-04 16:22:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 16:22:35 -0400 |
commit | e14b52ef84be7feeab60167605fd10918a242cd3 (patch) | |
tree | b9b124d9ed77806a7ad8b52c6e779da0f4844993 /ext/js/language/text-scanner.js | |
parent | b8bedd5185869edb33a7657fff323f812444eed0 (diff) |
Update dictionary entry terminology (#1592)
* Update terminology
* Update terminology in display.js
* Update terminology in display-audio.js
* Update terminology in text-scanner.js
* Update terminology in backend.js
* Update terminology in mecab.js
* Update terminology in audio-downloader.js
* Update terminology in translator-vm.js
* Update terminology in dictionary-data-util.js
* Update terminology in dictionary-database.js
* Update terminology in japanese-util.js
* Change/upgrade {expression} to {term}
* Update terminology in test-japanese.js
* Update terminology in test-database.js
* Update terminology in anki-templates-controller.js
* Update terminology in anki-note-builder.js
* Update terminology in backend.js
* Update terminology in text-scanner.js
* Update terminology in display.js
* Update terminology in display.js
Diffstat (limited to 'ext/js/language/text-scanner.js')
-rw-r--r-- | ext/js/language/text-scanner.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index 4dbd782b..b571435b 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -304,7 +304,7 @@ class TextScanner extends EventDispatcher { } async _search(textSource, searchTerms, searchKanji, inputInfo) { - let definitions = null; + let dictionaryEntries = null; let sentence = null; let type = null; let error = null; @@ -322,13 +322,13 @@ class TextScanner extends EventDispatcher { searched = true; - const result = await this._findDefinitions(textSource, searchTerms, searchKanji, optionsContext); + const result = await this._findDictionaryEntries(textSource, searchTerms, searchKanji, optionsContext); if (result !== null) { - ({definitions, sentence, type} = result); + ({dictionaryEntries, sentence, type} = result); this._inputInfoCurrent = inputInfo; this.setCurrentTextSource(textSource); } else if (textSource instanceof TextSourceElement && await this._hasJapanese(textSource.fullContent)) { - definitions = []; + dictionaryEntries = []; sentence = {sentence: '', offset: 0}; type = 'terms'; this._inputInfoCurrent = inputInfo; @@ -343,7 +343,7 @@ class TextScanner extends EventDispatcher { const results = { textScanner: this, type, - definitions, + dictionaryEntries, sentence, inputInfo, textSource, @@ -804,22 +804,22 @@ class TextScanner extends EventDispatcher { return null; } - async _findDefinitions(textSource, searchTerms, searchKanji, optionsContext) { + async _findDictionaryEntries(textSource, searchTerms, searchKanji, optionsContext) { if (textSource === null) { return null; } if (searchTerms) { - const results = await this._findTerms(textSource, optionsContext); + const results = await this._findTermDictionaryEntries(textSource, optionsContext); if (results !== null) { return results; } } if (searchKanji) { - const results = await this._findKanji(textSource, optionsContext); + const results = await this._findKanjiDictionaryEntries(textSource, optionsContext); if (results !== null) { return results; } } return null; } - async _findTerms(textSource, optionsContext) { + async _findTermDictionaryEntries(textSource, optionsContext) { const scanLength = this._scanLength; const sentenceScanExtent = this._sentenceScanExtent; const sentenceTerminatorMap = this._sentenceTerminatorMap; @@ -829,10 +829,10 @@ class TextScanner extends EventDispatcher { const searchText = this.getTextSourceContent(textSource, scanLength, layoutAwareScan); if (searchText.length === 0) { return null; } - const {definitions, length} = await yomichan.api.termsFind(searchText, {}, optionsContext); - if (definitions.length === 0) { return null; } + const {dictionaryEntries, originalTextLength} = await yomichan.api.termsFind(searchText, {}, optionsContext); + if (dictionaryEntries.length === 0) { return null; } - textSource.setEndOffset(length, layoutAwareScan); + textSource.setEndOffset(originalTextLength, layoutAwareScan); const sentence = this._documentUtil.extractSentence( textSource, layoutAwareScan, @@ -842,10 +842,10 @@ class TextScanner extends EventDispatcher { sentenceBackwardQuoteMap ); - return {definitions, sentence, type: 'terms'}; + return {dictionaryEntries, sentence, type: 'terms'}; } - async _findKanji(textSource, optionsContext) { + async _findKanjiDictionaryEntries(textSource, optionsContext) { const sentenceScanExtent = this._sentenceScanExtent; const sentenceTerminatorMap = this._sentenceTerminatorMap; const sentenceForwardQuoteMap = this._sentenceForwardQuoteMap; @@ -854,8 +854,8 @@ class TextScanner extends EventDispatcher { const searchText = this.getTextSourceContent(textSource, 1, layoutAwareScan); if (searchText.length === 0) { return null; } - const definitions = await yomichan.api.kanjiFind(searchText, optionsContext); - if (definitions.length === 0) { return null; } + const dictionaryEntries = await yomichan.api.kanjiFind(searchText, optionsContext); + if (dictionaryEntries.length === 0) { return null; } textSource.setEndOffset(1, layoutAwareScan); const sentence = this._documentUtil.extractSentence( @@ -867,7 +867,7 @@ class TextScanner extends EventDispatcher { sentenceBackwardQuoteMap ); - return {definitions, sentence, type: 'kanji'}; + return {dictionaryEntries, sentence, type: 'kanji'}; } async _searchAt(x, y, inputInfo) { |