Commit Graph

1517 Commits

Author SHA1 Message Date
toasted-nutbread
13f57cccba
Settings backup refactor (#551)
* Update backup.js to be a class

* Move utilReadFileArrayBuffer
2020-05-24 13:56:46 -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
3089bb7908
Settings refactor (#541)
* Remove debug info

* Trigger onOptionsUpdated instead of formWrite when profile changes

* Update how Anki field changes are observed

* Update how general.enableClipboardPopups setting is changed

* Change where ankiTemplatesUpdateValue occurs

* Change where onDictionaryOptionsChanged occurs

* Remove unused global declarations

* Remove stray data attribute
2020-05-24 13:38:48 -04:00
toasted-nutbread
4d2e5b93f4
Style adjustments (#537)
* Remove newlines for term-definition-item-template

* Update how action button icons are styled

* Fix spacing

* Group text colors together

* Correct image styles

* Fix missing </span>
2020-05-24 13:37:23 -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
694120b8a5
Cross frame communication (#531)
* Set up new cross-frame port connector

* Create classes for cross-frame API invocation with replies

* Remove event listeners on disconnect
2020-05-23 13:34:55 -04:00
siikamiika
39df44eca4
Fix "tags" template (#539)
* fix tag templates for merge and group modes

* update version upgrade

* adjust upgrade replacement order
2020-05-22 20:03:34 -04:00
toasted-nutbread
dd673f0b26
Dynamic loader load style (#521)
* Remove unnecessary load of /fg/css/client.css

* Replace dynamicLoader.loadStyles with dynamicLoader.loadStyle

* Replace Popup._injectStylesheet with dynamicLoader.loadStyle

* Remove unused global
2020-05-19 20:33:06 -04:00
toasted-nutbread
9742d5662b
Use CSS variables for themes (#528)
* Update formatting

* Merge default tag color with category-less tags

* Use CSS variables for colors

* Add dark theme colors

* Move color variables into display.css

* Remove old stylesheets

* Update headings

* Bump minimum Firefox version to support CSS var()

* Revert popular kanji text color
2020-05-10 14:07:25 -04:00
toasted-nutbread
bdbe680f5c
Omit the sound tag if it's empty (#525) 2020-05-09 12:29:41 -04:00
siikamiika
d6a3825a38
Modifier key platform names (#519)
* wip

* add environment class

* use Environment class

* use Environment for scanning modifier options

* remove Environment in favor of API

* await promise

* use modifier symbols on macOS

* fix key separator issues

* if else to switch

* simplify variable names
2020-05-09 18:36:00 +03:00
toasted-nutbread
3949db26d7
Text scanner refactor (#517)
* Fix return type

* Pass search function as a constructor argument

* Pass constructor as a details object

For consistency with other complex constructors and improved semantics.

* Convert _ignorePoints to a single optional function

* Organize functions

* Rename ignorePoints to ignorePoint
2020-05-08 19:05:50 -04:00
toasted-nutbread
b936c3e4b1
Popup proxy host refactor (#516)
* Rename PopupProxyHost to PopupFactory

* Update FrontendApiReceiver to support non-async handlers

* Make some functions non-async

* Make setCustomCss non-async

* Make setContentScale non-async

* Remove static

* Rename variables

* Pass frameId into PopupFactory's constructor

* Change FrontendApiReceiver source from popup-proxy-host to popup-factor

* Rename _invokeHostApi to _invoke

* Rename PopupProxy.getHostUrl to getUrl
2020-05-08 19:04:53 -04:00
toasted-nutbread
33bd9682ea
Query parser refactor (#514)
* Make functions private

* Make fields private

* Organize
2020-05-07 19:41:27 -04:00
toasted-nutbread
caca9869c4
Add contentScript parameter to backend message handlers (#512)
* Add contentScript parameter to message handlers

* Remove _validatePrivilegedMessageSender calls from handler functions

* Reformat handlers
2020-05-07 19:37:25 -04:00
toasted-nutbread
f361139d74
Japanese util refactor (#510)
* Convert mixed japanese.js to utility class

* Copy functions from bg/js/japanese.js into mixed/js/japanese.js

* Remove bg/js/japanese.js

* Make wanakana dependency optional

* Update tests
2020-05-06 19:37:36 -04:00
toasted-nutbread
4eeb879fb8
Remove search query parser inheritance (#509)
* Remove getMouseEventListeners override

* Use this._options instead of this.options

* Make QueryParser use composition instead of inheritance for TextScanner

* Remove repeat call to document.querySelector('#query-parser-content')
2020-05-06 19:36:42 -04:00
toasted-nutbread
38d6f58fac
Frontend refactor (#508)
* Use this.popup instead of this.frontend.popup

* Rename Frontend.popup to _popup

* Make Frontend functions private

* Clean up Frontend constructor
2020-05-06 19:35:36 -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
ac2f743b76
Remove invalid file name characters from Anki media files (#496)
* Replace invalid file name characters

* Replace "filename" with "fileName"
2020-05-06 19:25:56 -04:00
siikamiika
a88501ff10
Text selection fixes (#511)
* select matched text in Frontend.findKanji

* blur search query input when setting content
2020-05-07 01:49:42 +03:00
siikamiika
253dcf8b38
Fix modifier key condition data (#506)
* save transformed data for modifier key conditions

* validate transformed input

* fix regression

* undo rename

* refactor transformInput handling

* don't overwrite value with null
2020-05-06 19:44:56 +03:00
siikamiika
a1f8f0d1de
support meta as scanning modifier (#502) 2020-05-05 00:14:21 +03:00
siikamiika
7d7ff165ce
Extract textSource text inside TextScanner (#500)
* extract text inside TextScanner

* clone textSource before text extraction
2020-05-05 00:13:43 +03:00
siikamiika
77b744e675
Modifier key profile condition (#487)
* update Frontend options on modifier change

* add modifier key profile condition

* use select element for modifier condition value

* support "is" and "is not" modifier key conditions

* use plural

* remove dead null check

it's never null in that function

* pass element on rather than assigning to this

* rename event

* remove Firefox OS key to Meta detection

* hide Meta from dropdown on Firefox

* move input type
2020-05-03 04:39:24 +03:00
toasted-nutbread
d581bffa15
Style fixes (#494)
* Place multi-line expression parentheses on the correct line

* Add function-paren-newline eslint rule

* Add some additional eslint rules
2020-05-02 13:04:17 -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
6c341a13d8
Refactor frontend API classes (#482)
* Mark functions as private

* Remove constructor side effects

* Use safer handler invocation

* Mark functions as private

* Mark fields as private

* Update BackendApiForwarder public API
2020-05-02 12:50:44 -04:00
toasted-nutbread
cae6b657ab
Anki audio download (#477)
* Update how audio is added to Anki cards

* Upgrade Anki templates

* Update comments
2020-05-02 12:50:16 -04:00
toasted-nutbread
08ada6844a
Remove Frontend inheritance (#486)
* Make Frontend use composition instead of inheritance for TextScanner

* Use push instead of concat

* Update setOptions and setEnabled APIs

* Update how onWindowMessage event listener is added/removed

* Rename options to _options

* Use bind instead of arrow function

* Fix selection being cleared due to settings changes
2020-05-02 12:47:15 -04:00
Allan Wirth
ce861ce079
Add helpful link for markers in settings.html (#489) 2020-05-01 16:59:19 -04:00
toasted-nutbread
0956634d61
Add duplicateScope: 'deck' option (#476)
* Add duplicateScope: 'deck' option

* Add option to control duplicate scope

* Use duplicateScope for findNoteIds

* Update location of quotes
2020-04-27 18:10:59 -04:00
toasted-nutbread
48c7010f4e
Frontend refactor (part 1) (#484)
* Remove _getVisualViewportScale

* Use super's mouse event listener definitions

* Remove redundant override

* Remove getTouchEventListeners override

* Rename Display.onSearchClear to onEscape

* Change onSearchClear to clearSelection and use an event

* Update how text is marked for selection and deselection

* Replace onError with yomichan.logError

* Update setEnabled to refresh all event listeners
2020-04-27 18:10:37 -04:00
toasted-nutbread
887d769786
Use dynamicLoader for main (#481)
* Update style of search-main and float-main to have better parity

* Use dynamicLoader to inject scripts and CSS
2020-04-26 16:56:34 -04:00
toasted-nutbread
4e0fc76fe1
Add Yomichan icon SVG (#478)
* Create Yomichan icon SVG and 32x32 PNG

* Update icons

* Add 32x32 icon definition to HTML pages
2020-04-26 16:56:14 -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
siikamiika
ca033a87a0
Update Popup and DisplayFloat optionsContext from Frontend (#464)
* set optionsContext from Frontend

* update Popup+Display options on Frontend change

* remove popup setOptions

* only update DisplayFloat options from Frontend

* fix optionsContext usage

* fix preview frame arguments

* keep Frontend URL up to date

* cache url

* fix preview frame

* trigger modifyingProfileChange in correct places

* remove async from function not using await

* refactor optionsContext in Frontend
2020-04-26 22:33:50 +03:00
toasted-nutbread
9216d1862f
Merge pull request #463 from toasted-nutbread/explicit-entry-point
Explicit entry points
2020-04-23 18:26:34 -04:00
siikamiika
6cd86e203a fix custom anki templates 2020-04-23 19:58:31 +03:00
toasted-nutbread
d8276a9d5d Use IIFE for entry points 2020-04-22 21:42:20 -04:00
toasted-nutbread
c43dac19a4 Use wanakana object directly 2020-04-20 22:23:07 -04:00
toasted-nutbread
7c578f7582 Create popup-preview-frame-main.js 2020-04-19 14:29:43 -04:00
toasted-nutbread
4d3d5d9ccb Rename search-frontend.js to search-main.js
Also move DisplaySearch creation into the main() function.
2020-04-19 14:29:41 -04:00
toasted-nutbread
3edaf319da Rename context.js to context-main.js 2020-04-19 14:27:15 -04:00
toasted-nutbread
3c8eb9eee0 Create background-main.js 2020-04-19 14:26:44 -04:00
toasted-nutbread
6c93d1984f Change frontend-initialize.js to content-script-main.js 2020-04-19 14:26:20 -04:00
toasted-nutbread
a7e7d546c7 Add documentation 2020-04-19 10:24:59 -04:00
toasted-nutbread
0e80c0d5d0 Rename loadImage to loadImageBase64 for clarity 2020-04-19 10:24:43 -04:00