diff options
author | Darius Jahandarie <djahandarie@gmail.com> | 2023-11-12 11:19:43 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-12 11:19:43 +0900 |
commit | 47b4d79e646a990699a1a4ca1da559a4aeec1c91 (patch) | |
tree | c33f61ba85354f18c68d4a054baa30ff0c41c153 /ext/js/language/text-scanner.js | |
parent | 9162d950eb2b3aa0339d95a98a60be89b8315f26 (diff) | |
parent | d06029ea8c4244f40f9ddfeec5154f9ef2a4c053 (diff) |
Merge branch 'master' into offscreen-db
Diffstat (limited to 'ext/js/language/text-scanner.js')
-rw-r--r-- | ext/js/language/text-scanner.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index bd5b0fbe..ac7ef3d9 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -18,7 +18,7 @@ import {EventDispatcher, EventListenerCollection, clone, isObject, log, promiseTimeout} from '../core.js'; import {DocumentUtil} from '../dom/document-util.js'; -import {yomichan} from '../yomichan.js'; +import {yomitan} from '../yomitan.js'; export class TextScanner extends EventDispatcher { constructor({ @@ -89,7 +89,7 @@ export class TextScanner extends EventDispatcher { this._canClearSelection = true; this._textSelectionTimer = null; - this._yomichanIsChangingTextSelectionNow = false; + this._yomitanIsChangingTextSelectionNow = false; this._userHasNotSelectedAnythingManually = true; } @@ -270,13 +270,13 @@ export class TextScanner extends EventDispatcher { setCurrentTextSource(textSource) { this._textSourceCurrent = textSource; if (this._selectText && this._userHasNotSelectedAnythingManually) { - this._yomichanIsChangingTextSelectionNow = true; + this._yomitanIsChangingTextSelectionNow = true; this._textSourceCurrent.select(); if (this._textSelectionTimer !== null) { clearTimeout(this._textSelectionTimer); } // This timeout uses a 50ms delay to ensure that the selectionchange event has time to occur. // If the delay is 0ms, the timeout will sometimes complete before the event. this._textSelectionTimer = setTimeout(() => { - this._yomichanIsChangingTextSelectionNow = false; + this._yomitanIsChangingTextSelectionNow = false; this._textSelectionTimer = null; }, 50); this._textSourceCurrentSelected = true; @@ -390,7 +390,7 @@ export class TextScanner extends EventDispatcher { } _onSelectionChangeCheckUserSelection() { - if (this._yomichanIsChangingTextSelectionNow) { return; } + if (this._yomitanIsChangingTextSelectionNow) { return; } this._userHasNotSelectedAnythingManually = window.getSelection().isCollapsed; } @@ -881,7 +881,7 @@ export class TextScanner extends EventDispatcher { const details = {}; if (this._matchTypePrefix) { details.matchType = 'prefix'; } - const {dictionaryEntries, originalTextLength} = await yomichan.api.termsFind(searchText, details, optionsContext); + const {dictionaryEntries, originalTextLength} = await yomitan.api.termsFind(searchText, details, optionsContext); if (dictionaryEntries.length === 0) { return null; } textSource.setEndOffset(originalTextLength, false, layoutAwareScan); @@ -908,7 +908,7 @@ export class TextScanner extends EventDispatcher { const searchText = this.getTextSourceContent(textSource, 1, layoutAwareScan); if (searchText.length === 0) { return null; } - const dictionaryEntries = await yomichan.api.kanjiFind(searchText, optionsContext); + const dictionaryEntries = await yomitan.api.kanjiFind(searchText, optionsContext); if (dictionaryEntries.length === 0) { return null; } textSource.setEndOffset(1, false, layoutAwareScan); @@ -1145,7 +1145,7 @@ export class TextScanner extends EventDispatcher { async _hasJapanese(text) { try { - return await yomichan.api.textHasJapaneseCharacters(text); + return await yomitan.api.textHasJapaneseCharacters(text); } catch (e) { return false; } |