aboutsummaryrefslogtreecommitdiff
path: root/ext/js/language/text-scanner.js
Commit message (Collapse)AuthorAge
* fix: window.getSelection() can return null on Firefoxpraschke2023-08-17
|
* fixed eslint, changed header to only use 2 spaces, added missing headers to testAustin Siew2023-03-22
|
* Updated LICENSE to full license, added Yomitan 2023 to all license headersAustin Siew2023-03-21
|
* Fix text selection not always working properly (#2246)toasted-nutbread2022-10-15
|
* TextSource* API updates (#2236)toasted-nutbread2022-09-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move TextSourceRange static functions to DocumentUtil getWritingMode is also simplified * Update Google Docs range to be empty to match other range sources * Rename imposterContainer to imposterElement * Add static creation functions * Add static creation function * Remove unused collapse function * Don't select imposter elements * Refactor setEndOffset * Adjust argument order for setEndOffset * Update TextSourceRange constructor * Remove unused isConnected * Cache rects * Fix test * Remove unused getRect * Revert "Fix test" * Remove cachedRect * Use the source element rect to handle scroll differences * Writing mode update * Remove _cachedRects update This shouldn't be necessary as the imposter is usually detached almost immediately after scanning, giving no time for the window to be resized or scrolled.
* DocumentUtil static (#2232)toasted-nutbread2022-09-24
| | | | | | | | | | | | | | | * Make all methods static The two non-static methods are kept for temporary compatibility * Use this instead of class name now that functions are static * Update test * Don't instantiate DocumentUtil * Remove temporary non-static methods * Remove unused global declaration
* Exclude documentElement from zoom calculation (#2227)toasted-nutbread2022-09-20
| | | | | | | | | | | | | | | * Exclude documentElement from zoom calculation * Add an option * Refactor zoom coordinate conversion functions * Convert zoom coordinates for text sources * Rename variable * Convert rect coordinate spaces * Handle shadow DOM
* Fix setEndOffset (#2214)toasted-nutbread2022-08-20
| | | | | * Add _layoutAwareScan option to TextSourceElement.setEndOffset for parity * Remove default param
* Do not change selection if user selected text manually (#2186)oakkitten2022-07-01
| | | | | | | | | | | | | | * Do not change selection if user selected text manually * Remove capture argument for selectionchange listener It is not applicable * Make a note of user selection when Yomichan is enabled User might have some text selected on a page prior to enabling Yomichan via the toolbar icon; let it stay intact. * Extract selection change by user listener into a method
* TextScanner refactor (#2174)toasted-nutbread2022-06-05
| | | | | * Refactor input conversion, add additional validation * Simplify input data structure
* Touch and pen input updates (#2172)toasted-nutbread2022-06-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove unnecessary return * Move touch start input filtering * Refactor * Add scanOnTouchPress * Add preventPenScrolling * Rename scanOnPenPress to scanOnPenMove * Rename scanOnPenRelease to scanOnPenReleaseHover * Simplify * Refactor _searchAtFromPen early exit * Merge _penPointerPressed and _penPointerReleased into a single variable * Add more options * Simplify pen pointer coordinates * Implement scanOnPenPress and scanOnPenRelease * Implement scanOnTouchRelease * Fix tests * Don't search on touch cancel * Cancel touch if the touch action is used for scrolling or other gestures * Fix incorrect scroll prevention options being used * Organize options * Fix typos
* Text scanner event capture (#2101)toasted-nutbread2022-04-02
| | | | | * Add capture parameter to event listeners * Enable capture
* Update copyright date (#2062)toasted-nutbread2022-02-02
| | | | | | | * Update eslint settings * Update 2021 files * Update other files
* Scanning wildcards (#2042)toasted-nutbread2021-12-18
| | | | | | | | | * Add scanning.matchTypePrefix option * Update TextScanner to use matchTypePrefix option * Add setting * Update warning
* Search query offset value (#1968)toasted-nutbread2021-09-27
| | | | | | | | | | | * Add type property to TextSource* classes * Use type property rather than instanceof * Expose a sentence offset value * Use offset added to URL * Improve fallback sentence for Anki note context
* Fix popup preview disappearing after changing a setting (#1707)toasted-nutbread2021-05-23
|
* Selection clear improvements (#1690)toasted-nutbread2021-05-19
| | | | | | | | | * Update selection clear process * Clean up old clearSelection API * Update clear order * Add clear event handling
* Sentence termination character mode (#1682)toasted-nutbread2021-05-16
| | | | | | | | | | | * Change enableTerminationCharacters to terminationCharacterMode * Update settings * Update sentence extraction * Update tests * Add tests
* Add support for restoring the selection after using scanSelectedText (#1631)toasted-nutbread2021-04-26
|
* Update dictionary entry terminology (#1592)toasted-nutbread2021-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix text selection during scanning (#1508)toasted-nutbread2021-03-09
| | | | | | | | | * Move function * Add _onSearchClick function * Move _onSearchClick after event prevention * Prevent search if selection is changed before a click occurs
* Text source element scanning improvements (#1464)toasted-nutbread2021-02-28
| | | | | | | | * Add api.textHasJapaneseCharacters * Add support for empty query * Add support for showing the query parser for TextSourceElement with content that does not start with Japanese text
* Log refactoring (#1393)toasted-nutbread2021-02-14
| | | | | | | | | | | | | * Create Logger class and log instance * Replace yomichan.logWarning with log.warn * Replace yomichan.logError with log.error * Replace yomichan.log with log.log * Update the Yomichan class to use the global log object * Update lint rules
* Move api to yomichan object (#1392)toasted-nutbread2021-02-14
| | | | | | | | | | | * Move cross frame API from API to Yomichan * Add API instance to Yomichan * Move api global to yomichan.api * Pass yomichan to API * Remove IIFE
* Move mixed/js (#1383)toasted-nutbread2021-02-13
* Move mixed/js/core.js to js/core.js * Move mixed/js/yomichan.js to js/yomichan.js * Move mixed/js/timer.js to js/debug/timer.js * Move mixed/js/hotkey-handler.js to js/input/hotkey-handler.js * Move mixed/js/hotkey-help-controller.js to js/input/hotkey-help-controller.js * Move mixed/js/hotkey-util.js to js/input/hotkey-util.js * Move mixed/js/audio-system.js to js/input/audio-system.js * Move mixed/js/media-loader.js to js/input/media-loader.js * Move mixed/js/text-to-speech-audio.js to js/input/text-to-speech-audio.js * Move mixed/js/comm.js to js/comm/cross-frame-api.js * Move mixed/js/api.js to js/comm/api.js * Move mixed/js/frame-client.js to js/comm/frame-client.js * Move mixed/js/frame-endpoint.js to js/comm/frame-endpoint.js * Move mixed/js/display.js to js/display/display.js * Move mixed/js/display-audio.js to js/display/display-audio.js * Move mixed/js/display-generator.js to js/display/display-generator.js * Move mixed/js/display-history.js to js/display/display-history.js * Move mixed/js/display-notification.js to js/display/display-notification.js * Move mixed/js/display-profile-selection.js to js/display/display-profile-selection.js * Move mixed/js/japanese.js to js/language/japanese-util.js * Move mixed/js/dictionary-data-util.js to js/language/dictionary-data-util.js * Move mixed/js/document-focus-controller.js to js/dom/document-focus-controller.js * Move mixed/js/document-util.js to js/dom/document-util.js * Move mixed/js/dom-data-binder.js to js/dom/dom-data-binder.js * Move mixed/js/html-template-collection.js to js/dom/html-template-collection.js * Move mixed/js/panel-element.js to js/dom/panel-element.js * Move mixed/js/popup-menu.js to js/dom/popup-menu.js * Move mixed/js/selector-observer.js to js/dom/selector-observer.js * Move mixed/js/scroll.js to js/dom/window-scroll.js * Move mixed/js/text-scanner.js to js/language/text-scanner.js * Move mixed/js/cache-map.js to js/general/cache-map.js * Move mixed/js/object-property-accessor.js to js/general/object-property-accessor.js * Move mixed/js/task-accumulator.js to js/general/task-accumulator.js * Move mixed/js/environment.js to js/background/environment.js * Move mixed/js/dynamic-loader.js to js/scripting/dynamic-loader.js * Move mixed/js/dynamic-loader-sentinel.js to js/scripting/dynamic-loader-sentinel.js