Commit Graph

3412 Commits

Author SHA1 Message Date
toasted-nutbread
441b6882ca
Lint updates (#2247)
* Fix spacing

* Update lint dependencies

* Disable false positive rule

* Update header rule

* Install eslint-plugin-jsonc

* Update lint rules to include jsonc extension
2022-10-15 13:09:02 -04:00
toasted-nutbread
5e707248ce
Fix text selection not always working properly (#2246) 2022-10-15 11:40:22 -04:00
toasted-nutbread
abb3e5d5d0
Audio certificate error notification (#2243)
* Refactor error throwing and change ID

* Show a notification when an audio download fails due to an expired cert
2022-10-05 22:51:15 -04:00
toasted-nutbread
f76c7d74d0
Cleanup and refactoring (#2239)
* Remove unused ignoreSelectors

* Remove unused isMouseButtonPressed

* Update getWritingMode to use the immediate element if possible

* Move static functions to DocumentUtil

* Fix documentation
2022-09-27 20:17:59 -04:00
toasted-nutbread
be7855bad2
More API documentation (#2238)
* Document TextSourceRange

* Document TextSourceElement

* Document DocumentUtil

* Document DocumentFocusController
2022-09-26 19:37:14 -04:00
toasted-nutbread
018dc602d9 Update version 2022-09-25 09:54:57 -04:00
toasted-nutbread
642dcb8fc9
Google Docs accessibility simplifications (#2237)
* Use getAttribute instead of dataset, in case SVG node APIs are unusual

* Use pointer-events instead of fill

* Use elementFromPoint instead of elementsFromPoint
2022-09-25 09:42:20 -04:00
toasted-nutbread
75d3059451
TextSource* API updates (#2236)
* 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.
2022-09-25 09:37:33 -04:00
toasted-nutbread
8240482e9d
Google Docs accessibility update (#2235)
* Update Google Docs injection script

* Create GoogleDocsUtil

* Update Frontend.js to register GoogleDocsUtil's getRangeFromPoint handler

* Update setting name and description

* Add comment

* Fix Firefox support
2022-09-24 22:44:40 -04:00
toasted-nutbread
da52caa152
DocumentUtil extensibility (#2234)
* Update DocumentUtil.getRangeFromPoint to be extensible

* Add documentation
2022-09-24 17:17:10 -04:00
toasted-nutbread
115c3ce3d7
API loadExtensionScripts (#2233)
* Inject MV3 scripts immediately

* Add api.loadExtensionScripts
2022-09-24 16:41:21 -04:00
toasted-nutbread
1e91bf151f
DocumentUtil static (#2232)
* 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
2022-09-24 16:05:19 -04:00
toasted-nutbread
794b206870 Version update 2022-09-20 21:11:50 -04:00
toasted-nutbread
480869c3d1
Exclude documentElement from zoom calculation (#2227)
* 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
2022-09-20 21:06:39 -04:00
toasted-nutbread
227cbbc7cd Version update 2022-09-09 19:58:51 -04:00
toasted-nutbread
e7944d29b0
TextSourceElement surrogate pair support (#2217)
* Update StringUtil

* Refactor

* Handle UTF-16 surrogate pairs
2022-08-20 14:32:34 -04:00
toasted-nutbread
4194252fe3
New StringUtil (#2216)
* Create new StringUtil

* Use StringUtil in DOMTextScanner

* Fix order
2022-08-20 13:11:38 -04:00
toasted-nutbread
d3807d88ec
ArrayBufferUtil (#2215)
* Rename StringUtil to ArrayBufferUtil

* Update docs

* Rename file string-util.js to array-buffer-util.js
2022-08-20 12:53:22 -04:00
toasted-nutbread
cd0a6b60e2
Fix setEndOffset (#2214)
* Add _layoutAwareScan option to TextSourceElement.setEndOffset for parity

* Remove default param
2022-08-20 12:38:55 -04:00
toasted-nutbread
c5c5308ff2
Update DOMTextScanner to support UTF-16 surrogate pairs (#2213) 2022-08-20 11:32:20 -04:00
toasted-nutbread
5c267f4bb7
Profile index fixes (#2207)
* Update settings controller to consistently initialize

* Allow profile index to be reset if an error occurs

* Update message handler to be async

* Fix error when deleting the current profile
2022-08-20 11:31:50 -04:00
toasted-nutbread
9436928e3d
Optimize AnkiConnect.findNoteIds (#2190)
* Use for loop rather than map

* Add _getNoteQuery

* Optimize findNoteIds to reduce repeat queries
2022-08-20 11:31:06 -04:00
toasted-nutbread
ada4df1971
Fix invalid default values for popupTheme and popupOuterTheme (#2180)
* Fix invalid default values for popupTheme and popupOuterTheme

* Options update
2022-08-20 11:29:31 -04:00
toasted-nutbread
0b1ad40347
CSS zoom handling (#2178)
* Refactor

* Handle CSS zoom when scanning
2022-08-20 11:20:23 -04:00
toasted-nutbread
310303ca1a
Audio download timeout (#2187)
* Add support for an idle timeout when downloading audio

* Update eslint rules

* Pass idleTimeout to the downloader from DisplayAnki

* Add anki.downloadTimeout setting

* Update tests

* Assign _audioDownloadIdleTimeout using settings

* Show info about cancelled downloads

* Handle Firefox bug

* Improve audio errors

* Refactor

* Move functions to RequestBuilder
2022-08-20 11:17:24 -04:00
toasted-nutbread
02483a45b1
Fix TextSourceElement.getRects (#2177) 2022-08-20 11:14:46 -04:00
Stephen Kraus
c331ceae99
Add new structured content styling options (#2203)
Allow for arbitrary string assignment to the font-size property.
https://developer.mozilla.org/en-US/docs/Web/CSS/font-size

Add support for the text-align property.
https://developer.mozilla.org/en-US/docs/Web/CSS/text-align

Co-authored-by: stephenmk <stephenmk@users.noreply.github.com>
2022-08-14 13:30:25 -04:00
oakkitten
49c75c3093
Do not change selection if user selected text manually (#2186)
* 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
2022-07-01 17:12:55 -04:00
toasted-nutbread
4e7762edac Update version 2022-06-06 22:49:28 -04:00
toasted-nutbread
4545900f70
TextScanner refactor (#2174)
* Refactor input conversion, add additional validation

* Simplify input data structure
2022-06-05 22:46:00 -04:00
toasted-nutbread
6cc57d953d
Settings modal updates (#2173)
* Move the "Add" button into the footer

* Scroll to the bottom when adding

* Move the Audio Sources add button

* Simplify, remove the (?) link

* Move "Add" button to footer
2022-06-03 18:19:40 -04:00
toasted-nutbread
c966d9b1eb
Touch and pen input updates (#2172)
* 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
2022-06-03 17:11:32 -04:00
toasted-nutbread
aa5e13b441
Collapsible dictionary updates (#2170)
* Add "force collapsed" and "force expanded" options

* Simplify "any" check

* Update style

* Add help modal for collapsible dictionaries

* Disable wrapping
2022-05-30 13:34:37 -04:00
toasted-nutbread
19bba07a8b
Add support for Anki API key (#2169)
* Update material.css to support password fields

* Support password

* Add "apiKey" setting

* Use apiKey

* Update options if API key changes

* Update tests
2022-05-30 12:03:24 -04:00
toasted-nutbread
0b5d54e7c6
Rename anki.js to anki-connect.js to more accurately reflect class name (#2167) 2022-05-29 21:42:26 -04:00
toasted-nutbread
331a2e6294
Add support for guiEditNote to view notes (#2143)
* Add AnkiConnect.guiEditNote

* Update _onApiNoteView to first try guiEditNote

* Add setting

* Update noteView API

* Use setting

* Return which mode was used

* Update DisplayGenerator

* Handle errors in DisplayAnki

* Update docs

* Add isErrorUnsupportedAction function

* Add an allowFallback option to noteView

* Disambiguate

* Simplify now that preferredMode isn't used

* Update settings info

* Implement test buttons

* Update styles

* Update status visibility

* Wrap layout

* Update description

* Update date
2022-05-29 21:24:41 -04:00
toasted-nutbread
f3024c5018
Sort using number of definitions (#2166) 2022-05-29 20:53:21 -04:00
toasted-nutbread
5d0c22e76d
Sort using frequency dictionary before using dictionary priority (#2165) 2022-05-29 13:32:22 -04:00
toasted-nutbread
46fda6e653
Update referenceUrl to include fragment (#2164) 2022-05-29 12:02:31 -04:00
toasted-nutbread
47194926f3
Add an issues page with information about some errors (#2163) 2022-05-28 22:22:15 -04:00
toasted-nutbread
0d82c52a76
HTML page script refactoring (#2162)
* Move some common functionality

* Move setupEnvironmentInfo into ExtensionContentController

* Move background/environment.js to extension/environment.js
2022-05-28 21:57:25 -04:00
toasted-nutbread
4e4fa49b0b
Audio request errors (#2161)
* Generalize _onBeforeSendHeadersAddListener

* Simplify filter assignment

* Use requestId rather than done

* Properly support Firefox addListener without arguments

* Add details to fetchAnonymous errors

* Refactor

* Enable support for no header modifications

* Update MV3 support for error details

* Expose errors in downloadTermAudio

* Throw an error if audio download fails due to potential permissions reasons
2022-05-28 21:55:37 -04:00
toasted-nutbread
756cfc0276
Use \f rather than \x0C for whitespace form feed (#2158) 2022-05-22 13:11:38 -04:00
toasted-nutbread
259a3031ce
Add apiReflect and apiExists to AnkiConnect (#2150) 2022-05-22 11:26:49 -04:00
toasted-nutbread
5dbc284d53
Simplify assignment of _contentType = 'clear' (#2154) 2022-05-21 17:54:57 -04:00
toasted-nutbread
8b1d4450f5
Fix capitalization of "Non-Standard" (#2153) 2022-05-21 17:24:58 -04:00
toasted-nutbread
fd00a52856
Anki findNotes (#2152)
* Add findNotes API

* Add api.findAnkiNotes
2022-05-21 15:28:44 -04:00
toasted-nutbread
10e9f7acb8
Fix the color of links in display footer notifications (#2151) 2022-05-21 15:28:36 -04:00
toasted-nutbread
e498e2d029
Display notification updates (#2149)
* Expose container and node on DisplayNotification

* Add Display.createNotification

* Rename methods

* Rename fields

* Remove double newline
2022-05-20 18:08:20 -04:00
toasted-nutbread
31e20c889e
ESlint JSdoc (#2148)
* Install eslint-plugin-jsdoc

* Initial rules setup

* Update lists

* Use @returns rather than @return

* Remove error throwing code which is never executed

* Fix issues relating to @throws

* General error fixes

* Update Display type documentation

* Various doc fixes

* Fix invalid tuple syntax

* Doc updates

* Remove unused

* Doc updates

* Enable jsdoc/require-returns

* Update rules

* Update remaining rules
2022-05-20 10:28:38 -04:00