Commit Graph

54 Commits

Author SHA1 Message Date
toasted-nutbread
79ef6e151e
Cleanup unused utils (#832)
* Remove api.optionsSave

* Remove getOptionsMutable and getOptionsFullMutable

* Remove util.js

* Remove yomichanBackend
2020-09-15 19:48:58 -04:00
toasted-nutbread
5ec5d0c91c
Database change event (#826)
* Add api.triggerDatabaseUpdated and yomichan.on('databaseUpdated')

* Update databaseUpdated event usage
2020-09-13 18:43:44 -04:00
toasted-nutbread
f168efb69c
OptionsUtil refactor / options default values (#807)
* Replace _readFile with _fetchAsset for consistency with Backend

* Fix error messages

* Make OptionsUtil non-static

* Update how default options are assigned

* Add createValidatingProxy

* Add validate, update _onApiSetAllSettings

* Remove unused api.optionsSchemaGet

* Remove Backend._optionsSchema

* Update OptionsUtil to create its own JsonSchemaValidator

* Rename Backend._optionsSchemaValidator

* Make getDefault non-async
2020-09-11 14:15:08 -04:00
toasted-nutbread
a531618c48
Use Anki classes directly in Display (#804)
* Add _getTemplates function

* Add template renderer to display pages

* Add AnkiNoteBuilder to Display

* Update AnkiTemplatesController to directly use TemplateRenderer

* Remove old APIs
2020-09-10 18:03:46 -04:00
toasted-nutbread
9ce682272c
Add api.injectAnkiNoteMedia (#803) 2020-09-10 16:18:36 -04:00
toasted-nutbread
892f7ed3b8
Anki note api functions (#802)
* Assign duplicateScope to a variable

* Add api.addAnkiNote

* Add api.getAnkiNoteInfo, update returned data format
2020-09-10 16:05:17 -04:00
toasted-nutbread
35abd517b9
AudioUriBuilder simplification (#799)
* Rename variables to disambiguate

* Update handler argument convention

* Update getUri argument convention

* Change _getAudioUri argument convention

* Change getDefinitionAudio argument convention

* Add api.getDefinitionAudio definition
2020-09-10 11:57:38 -04:00
toasted-nutbread
5d2261acb9
Update the AnkiController class to use an instance of AnkiConnect directly (#795)
* Update AnkiController to use AnkiConnect instance directly

* Remove unused
2020-09-09 17:46:34 -04:00
toasted-nutbread
e3a7678769
Anki screenshot refactor (#791)
* Use more consistent style for injectScreenshot

* Move screenshot generation into AnkiNoteBuilder/Backend

* Get optionsContext before await
2020-09-09 12:54:59 -04:00
toasted-nutbread
115afb63b9
Add api.clipboardGetImage (#778)
* Rename clipboardPasteTarget to just target

* Remove else block

* Add helper functions

* Defer assignment of clipboard paste target

* Add api.clipboardGetImage
2020-09-06 14:38:03 -04:00
toasted-nutbread
8d53474945
Add api.isTabSearchPopup (#763)
* Add api.isTabSearchPopup

* Fix missing asyncs
2020-09-04 17:57:51 -04:00
toasted-nutbread
21fc0a80f2
Defer assignment of marker (#762) 2020-09-04 17:57:05 -04:00
toasted-nutbread
d8f488e28c
Settings dictionary import refactor (#759)
* Fix .purge not re-opening the database after deletion failure

* Create DictionaryImportController

* Remove backend dictionary import
2020-09-04 17:54:34 -04:00
toasted-nutbread
27e05f8001
Reusable backend popup window (#673)
* Update _updateSearchQuery to return the promise

* Update how the clipboard search popup is opened

* Create an API function to open the search popup

* Skip animation on popup creation

* Add API function
2020-07-18 20:30:10 -04:00
toasted-nutbread
a13a68990e
Port name details (#667)
* Use a stringified JSON details object for extension port names

* Fix incorrect frame ID check

* Add support for connecting to different tabs

* Add function for invoking on a different tab
2020-07-18 14:16:35 -04:00
toasted-nutbread
a07a8dfff6
Extension unload detection (#647)
* Update how extension unload is detected

* Remove event handlers and use yomichan.isExtensionUnloaded instead

* Update terminology
2020-07-03 12:20:22 -04:00
toasted-nutbread
f2345b7d1c
Use deferPromise (#630)
* Use deferPromise

* Move definition

* Implement promiseTimeout using deferPromise
2020-06-28 14:39:43 -04:00
toasted-nutbread
3e68af8666
Shadow DOM container for popup iframes (#623)
* Add support for injecting stylesheets into a custom parent node

* Add api.getStylesheetContent

* Add support for injecting a CSS file's content

* Add usePopupShadowDom option

* Use a per-parentNode cache

* Add support for using a shadow DOM wrapper around popup iframes

* Ignore the popup container instead of the frame
2020-06-24 21:46:13 -04:00
toasted-nutbread
9767b76553
Use cross frame API (#553)
* Use new CrossFrameAPI for popup proxy communication

* Remove use of old cross-frame communication classes

* Remove use of old cross-frame communication files

* Make the crossFrame object a member of the api object
2020-06-07 21:40:11 -04:00
toasted-nutbread
2c58b1c109
Limit action port message size (#587)
* Add onDisconnect handler

* Update how error is posted

* Update action ports to send long messages in fragments

* Remove ack timer

* Move message destructuring into try block
2020-05-31 18:17:12 -04:00
toasted-nutbread
976a200ffc
Backup update (#582)
* Add function to assign all settings

* Update how settings backups are restored

* Remove page reload

* Update profile index after importing
2020-05-30 16:23:56 -04:00
toasted-nutbread
66e1185686
Settings binder (#542)
* Fix _modifySetting being async

* Return values for modifySettings's set and splice actions

* Add apiGetSettings

* Create a class which can accumulate tasks to run in bulk

* Create a class which binds input elements to customizable sources

* Create class which binds input elements to settings

* Add support for value transforms

* Remove redundant ObjectPropertyAccessor.getPathArray

* Fix not using correct types for input.min/max/step

* Fix wrong condition

* Use api object
2020-05-24 13:50:34 -04:00
toasted-nutbread
c61a87b152
API refactor (#532)
* Convert api.js into a class instance

* Use new api.* functions

* Fix missing binds

* Group functions with progress callbacks together

* Change style

* Fix API override not working
2020-05-24 13:30:40 -04:00
toasted-nutbread
bb2d9501af
Add apiModifySettings (#501)
* Update getProfile/getProfileFromContext to store this.options in a variable

* Add useSchema parameter to options getter functions

* Add apiModifySettings

* Use apiModifySettings instead of apiOptionsSet

* Remove apiOptionsSet

* Fix incorrect deleteCount check

* Require explicit scope for options

* Throw on invalid scope
2020-05-06 19:32:28 -04:00
toasted-nutbread
021ccb5ac3
Move util database modification functions (#499)
* Update onProgress callback to handle multiple arguments

* Add apiImportDictionaryArchive

* Add apiDeleteDictionary

* Make onProgress the last argument for consistency

* Remove deprecated util functions

* Fix issue with missing progress args

* Remove function calls which modify the database from Translator

* Update tests

* Fix errors not being serialized correctly in _createActionListenerPort
2020-05-06 19:28:26 -04:00
toasted-nutbread
501281e887
Popup init update (#497)
* Add API function to send a message to a specific frameId in a tab

* Update _windowMessageHandlers to support additional info per handler

* Remove message token

* Add new authorization check

* Set up new initialization handler

* Update initialization

* Remove message token

* Replace 'prepare' with 'configure'

* Create new prepare function

* Change configure guard

* Log errors in onMessage

* Improve popup initialize function

* Clear secret/token in _resetFrame

* Remove backend message token

* Clear src and srcdoc attributes before loading

* Don't treat about:blank unloads as load events
2020-05-06 19:27:21 -04:00
toasted-nutbread
5a61c311ad
Api invoke with progress (#483)
* Create an internal API function to open a port

* Create system for running actions over a special port

* Don't assign in expression
2020-05-02 12:57:13 -04:00
toasted-nutbread
5b96559df8
Error logging refactoring (#454)
* Create new logging methods on yomichan object

* Use new yomichan.logError instead of global logError

* Remove old logError

* Handle unhandledrejection events

* Add addEventListener stub

* Update log function

* Update error conversion to support more types

* Add log event

* Add API log function

* Log errors to the backend

* Make error/warning logs update the badge

* Clear log error indicator on extension button click

* Log correct URL on the background page

* Fix incorrect error conversion

* Remove unhandledrejection handling

Firefox doesn't support it properly.

* Remove unused argument type from log function

* Improve function name

* Change console.warn to yomichan.logWarning

* Move log forwarding initialization into main scripts
2020-04-26 16:55:25 -04:00
toasted-nutbread
fd6ea0e404 Add API for getting media data 2020-04-18 21:32:35 -04:00
toasted-nutbread
7fc3882607 Update the parameters passed to various audio-related functions 2020-04-18 14:23:34 -04:00
toasted-nutbread
106172e2c1
Merge pull request #447 from toasted-nutbread/util-conversions
Util conversions
2020-04-18 14:12:41 -04:00
siikamiika
c613321a73 move QueryParser.parseText to Backend 2020-04-13 14:53:24 +03:00
toasted-nutbread
51e17b35e3 Convert some util* functions into api* functions 2020-04-11 15:25:19 -04:00
toasted-nutbread
a864cf094f
Merge pull request #437 from toasted-nutbread/backend-api-handler-changes
Backend api handler changes
2020-04-11 11:32:52 -04:00
toasted-nutbread
a296c758b9 apiBroadcast => apiBroadcastTab 2020-04-10 20:00:18 -04:00
4e5029f7ec Update license author field to broader to explicitly reflect that
Yomichan is an ongoing community project. It really does take a village,
and everyone who contributes code owns a part of it :)
2020-04-10 11:10:21 -07:00
toasted-nutbread
a2b66dc6cc Rename apiForward to apiBroadcast 2020-04-07 19:51:39 -04:00
toasted-nutbread
059db280bb Add custom context object for note creation 2020-04-06 18:20:04 -04:00
toasted-nutbread
8b07a23de9 Rename context to details 2020-04-06 18:20:04 -04:00
toasted-nutbread
aad4ab5ecc Rename audio functions using "url" to use "uri" 2020-03-07 21:57:26 -05:00
toasted-nutbread
8e29da0c6b Load default Anki field templates from a file 2020-02-27 20:33:13 -05:00
toasted-nutbread
0f46e3a093 Use a token to ensure that messages are coming from Yomichan 2020-02-17 11:02:21 -05:00
toasted-nutbread
2c3f510010 Allow apiInjectStylesheet to inject a URL 2020-02-16 21:43:35 -05:00
toasted-nutbread
496d2599ea Move error handling for apiDefinitionsAddable 2020-02-15 20:33:20 -05:00
toasted-nutbread
61c6a753ce Add apiTemplateRender back to mixed api.js 2020-02-14 20:11:40 -05:00
toasted-nutbread
e3c871bc00 Remove unused handlebarsRenderStatic 2020-02-13 20:50:30 -05:00
siikamiika
6c63a17d66 query parser html templates 2020-02-10 21:19:18 +02:00
toasted-nutbread
8ef57936d7 Add functionality for getting and observing zoom factor 2020-01-22 20:38:21 -05:00
toasted-nutbread
7686e56c00 Move display templates into a single file 2020-01-16 22:39:26 -05:00
toasted-nutbread
0d7ccf25b8 Update license info URL 2020-01-01 12:00:31 -05:00