Commit Graph

287 Commits

Author SHA1 Message Date
toasted-nutbread
c62f980f37
Audio controller (#569)
* Convert audio.js into a class

* Move audio-ui.js classes into audio.js

* Rename fields

* Merge classes

* Remove audio-ui.js
2020-05-29 19:56:38 -04:00
toasted-nutbread
5f9889fd26
Anki settings controllers (#567)
* Convert anki-templates.js to a class

* Convert anki.js to a class
2020-05-29 19:52:51 -04:00
toasted-nutbread
fde0072118
Change profile.js into a class (#566)
* Update how settings profile is stored and accessed

* Convert profiles.js into a class

* Rename members of ProfileController
2020-05-29 19:47:18 -04:00
toasted-nutbread
8537c8f386
Create class to abstract access, mutation, and events for settings (#565) 2020-05-29 19:45:54 -04:00
toasted-nutbread
37f0396f1c
DOM binder fixes (#564)
* Fix incorrect updateValue function

* Add source
2020-05-29 19:44:53 -04:00
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
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
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
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
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
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
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
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
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
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
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
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
9fe7b9ad29 Remove unused global 2020-04-18 14:23:34 -04:00
toasted-nutbread
e1ebfb02f7 Disable cache on the backend and fix a bug with the cache key 2020-04-18 14:23:34 -04:00
toasted-nutbread
823c026533 Remove de/structuring from public API 2020-04-18 14:23:34 -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
toasted-nutbread
649adb13d8
Merge pull request #440 from toasted-nutbread/collapse-emphatic-sequences
Add support for collapsing emphatic character sequences
2020-04-12 11:42:46 -04:00
toasted-nutbread
51e17b35e3 Convert some util* functions into api* functions 2020-04-11 15:25:19 -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
42a2917bf7 Add support for collapsing emphatic character sequences 2020-04-10 11:56:18 -04:00
toasted-nutbread
f177e3699a
Merge pull request #434 from toasted-nutbread/error-fixes
Error fixes
2020-04-07 19:28:07 -04:00
toasted-nutbread
ac1ecb35ee
Merge pull request #433 from toasted-nutbread/extra-dictionary-information
Extra dictionary information
2020-04-07 19:27:58 -04:00
toasted-nutbread
1d7c86ded0 Add document-title tag to settings options 2020-04-06 18:20:04 -04:00
toasted-nutbread
4011a091b6 Add support for {document-title} 2020-04-06 18:20:04 -04:00
toasted-nutbread
059db280bb Add custom context object for note creation 2020-04-06 18:20:04 -04:00
toasted-nutbread
9dfe531dfd Use logError instead of console.log 2020-04-05 18:27:53 -04:00
toasted-nutbread
7449ffd4dc Fix error reporting during dictionary import 2020-04-05 18:26:38 -04:00
toasted-nutbread
dd9d50bfc1 Update settings page to display additional information 2020-04-05 14:46:45 -04:00
siikamiika
31a326fe63 add option for iframe popups 2020-04-05 20:03:42 +03:00
toasted-nutbread
cbc7e2646d Add options 2020-03-28 10:25:57 -04:00
toasted-nutbread
64fc0349a1 Update global declarations 2020-03-10 22:40:35 -04:00
toasted-nutbread
aad4ab5ecc Rename audio functions using "url" to use "uri" 2020-03-07 21:57:26 -05:00
toasted-nutbread
7ac1c843a9 Use dependency injection for apiTemplateRender 2020-03-07 21:47:48 -05:00
toasted-nutbread
69cce49b0d Move Anki note generation functionality into a new class 2020-03-07 21:46:59 -05:00
toasted-nutbread
a8eb50d96f Use dependency injection for getAudioUri implementation 2020-03-07 21:43:51 -05:00
toasted-nutbread
d8e2e69ca5 Use AudioSystem on the audio settings page 2020-03-07 21:42:18 -05:00
siikamiika
e0edb30efd fix Backend prepare issues in settings 2020-03-02 11:18:09 +02:00
siikamiika
2abf46b6fa simplify backend prepare 2020-03-01 23:06:37 +02:00
toasted-nutbread
8e29da0c6b Load default Anki field templates from a file 2020-02-27 20:33:13 -05:00
toasted-nutbread
fdfc2d33bb Simplify event to use bind 2020-02-26 21:19:22 -05:00
toasted-nutbread
2d109c3e56 Use functions directly rather than wrapping in () => {} when args are same 2020-02-26 21:17:01 -05:00
toasted-nutbread
8bc1a40914 Use .bind instead of () => {} 2020-02-26 21:01:40 -05:00
toasted-nutbread
78dc501d02 Move event handler definitions 2020-02-26 20:07:14 -05:00
toasted-nutbread
6bd714fec0 Use Map to avoid using for in 2020-02-25 22:12:00 -05:00
toasted-nutbread
15f79bc78b Fix popupScalingFactor being limited to integer values 2020-02-23 21:12:43 -05:00
toasted-nutbread
c0d91bffc4 Add no-shadow 2020-02-22 14:53:02 -05:00
toasted-nutbread
56567903a5 Fix unnamed functions 2020-02-22 14:52:09 -05:00
toasted-nutbread
aa76113e75 Fix block padding 2020-02-22 14:52:09 -05:00
toasted-nutbread
452eec8a88 Use Map 2020-02-22 14:36:07 -05:00
toasted-nutbread
aee16c4431 Check origin on window messages 2020-02-16 23:41:17 -05:00
toasted-nutbread
9fd6ee382d Create more generic function for injecting stylesheets 2020-02-16 21:46:13 -05:00
toasted-nutbread
d3aefdc4e3 Override setCustomOuterCss instead of Popup.injectOuterStylesheet 2020-02-16 21:45:30 -05:00
toasted-nutbread
b6a50e234c Change parameter name 2020-02-16 21:44:45 -05:00
toasted-nutbread
dcd243c9e9 Update how popups are created 2020-02-16 18:59:08 -05:00
toasted-nutbread
070ae70f7c Create EventListenerCollection class 2020-02-16 18:47:57 -05:00
toasted-nutbread
faf15c08aa Rename optionsUpdate event to optionsUpdated
Past tense better indicates that the options were changed, but no data
is being included as part of the event. It is also more consistent with
the other event names the yomichan object currently provides.
2020-02-14 22:34:44 -05:00
toasted-nutbread
e2ac478cb7 Define more globals 2020-02-11 22:22:16 -05:00
toasted-nutbread
ab9d2b38e0 Remove redundant declaration 2020-02-11 22:22:16 -05:00
toasted-nutbread
4629fb3639 Change no-undef from off to error 2020-02-11 22:22:16 -05:00
siikamiika
91682dd633 add permission check to formRead 2020-02-09 21:51:33 +02:00
siikamiika
37a922adc0 fix settings page checkbox 2020-02-09 21:51:33 +02:00
siikamiika
939ad42dac add global clipboard monitor that spawns popups
TODO: refactor the search page clipboard monitor and popup clipboard
monitor to use a common ClipboardMonitor class
2020-02-09 21:51:33 +02:00
toasted-nutbread
e8701cb950 Hide anki-invalid-response-error when there is no error 2020-02-02 14:53:32 -05:00
siikamiika
b8326138a3 add scannable tags for expression and reading 2020-02-02 13:57:30 +02:00
toasted-nutbread
d5c0155a82 Update main dictionary value when changing modifying profile 2020-02-01 21:00:43 -05:00
toasted-nutbread
8eaa0334ac Remove option for dictionaries that aren't installed after changing values 2020-02-01 21:00:43 -05:00
toasted-nutbread
55047def9d Separate the functionality of updateMainDictionarySelect
One function now updates the options, and another handles updating the value.
The options are no longer mutated due to updating this <select>'s available options.
2020-02-01 21:00:43 -05:00
toasted-nutbread
748cd27ad0 Remove argument from onDictionaryOptionsChanged 2020-02-01 21:00:43 -05:00
toasted-nutbread
566012f228 Use await 2020-02-01 21:00:43 -05:00
toasted-nutbread
2dbb24ea04 Improve error messages when Interface server is invalid 2020-01-26 21:01:19 -05:00
toasted-nutbread
1f3ff6fad0 Fix equals function on TextSourceRange when imposter elements are used 2020-01-26 10:31:17 -05:00
siikamiika
e70638e8ea fix term spacing value display in settings 2020-01-26 00:56:52 +02:00
siikamiika
7357eaf07a
Merge pull request #330 from siikamiika/query-parser-helper-disabling
Query parser helper disabling
2020-01-25 03:29:55 +02:00
toasted-nutbread
67759b7aa3 Add convertHiraganaToKatakana option 2020-01-24 20:15:25 -05:00
toasted-nutbread
538d83c5a6 Reorganized variants to better reflect usage order 2020-01-24 20:15:25 -05:00
toasted-nutbread
4415a71ae2 Add translation options 2020-01-24 20:15:25 -05:00
siikamiika
fa4004437d query parser: add toggle for term spacing 2020-01-25 02:57:57 +02:00
toasted-nutbread
5d366b722f Add option for changing poup scale relative to visual viewport 2020-01-22 20:38:21 -05:00
toasted-nutbread
351598a182 Add settings to control popup content scale 2020-01-22 20:38:21 -05:00
toasted-nutbread
f725549330 Remove redundant window resize handler 2020-01-22 20:38:21 -05:00
toasted-nutbread
26ea278c29 Improve debug logging 2020-01-21 19:08:56 -05:00
toasted-nutbread
0d7ccf25b8 Update license info URL 2020-01-01 12:00:31 -05:00
toasted-nutbread
899ef167d1 Update copyright 2020-01-01 12:00:00 -05:00
toasted-nutbread
e2a4a46e60 Implement settings reset 2019-12-29 12:33:28 -05:00
toasted-nutbread
f17b55239e Implement settings import 2019-12-29 12:33:28 -05:00
toasted-nutbread
5045a9a3a0 Implement settings export 2019-12-29 12:33:28 -05:00
toasted-nutbread
d2ae7364bb Update anki-templates.js to control the value of fieldTemplates
Also assigns a value of null when using the default value
2019-12-29 12:33:03 -05:00
toasted-nutbread
3033fea31e Treat null templates as the default value 2019-12-29 12:33:03 -05:00
toasted-nutbread
a2175f2c29 Move PopupProxyHost initialization 2019-12-21 13:27:32 -05:00
toasted-nutbread
7ae0584077 Update initialization 2019-12-21 13:19:31 -05:00
toasted-nutbread
8c236cca44 Remove unused yomichan_frontend 2019-12-20 23:20:22 -05:00
toasted-nutbread
2a95f1420f Move optionsUpdate message handler into Yomichan class 2019-12-20 13:36:54 -05:00
toasted-nutbread
29734ea6e9 isVisible => isVisibleSync 2019-12-16 19:54:41 -05:00
toasted-nutbread
41fadfd0a9 Add setChildrenSupported to popup 2019-12-16 19:54:41 -05:00
toasted-nutbread
7140a19100 Remove unused property assignment 2019-12-16 19:54:41 -05:00
toasted-nutbread
db7e179626 Clear files after getting the value 2019-12-15 15:51:30 -05:00
toasted-nutbread
8c9416d70d Move conditions-ui into settings folder 2019-12-14 12:08:07 -05:00
toasted-nutbread
87ece13647 Isolate arguments passed across window contexts 2019-12-14 11:12:39 -05:00
toasted-nutbread
b1f72905cf Add functions for modifying mutable options 2019-12-13 23:11:56 -05:00
toasted-nutbread
17277a6450 Remove getOptionsArray 2019-12-13 23:11:56 -05:00
toasted-nutbread
4177b63726 Remove redundant getUrl handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
7837e9f0e3 Update popup preview frame message handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
f287d68624 Add showContentCompleted for improved semantic clarity 2019-12-11 21:31:21 -05:00
toasted-nutbread
99867ebdd8 Fix text source issue 2019-12-11 21:27:42 -05:00
toasted-nutbread
7446c99f98 Fix Text-to-speech voice dropdown being reset 2019-12-11 21:15:51 -05:00
toasted-nutbread
2dad7f888b Update how errors are reported when importing a dictionary 2019-12-08 16:01:29 -05:00
siikamiika
b8fddd96c8 fix popup preview
resolves #302
2019-12-08 11:10:19 +02:00
toasted-nutbread
b862035fbc Show info about whether a dictionary supports wildcard searches 2019-12-07 14:34:35 -05:00
toasted-nutbread
1a0a345ae7 Make reverse reading/expressions optional during database import 2019-12-07 14:34:35 -05:00
toasted-nutbread
b418760a52 Simplify audio settings UI 2019-12-05 22:36:59 -05:00
toasted-nutbread
774db569eb Simplify ankiGetFieldMarkersHtml 2019-12-02 22:19:55 -05:00
toasted-nutbread
5339381c30 Update how anki data is updated 2019-12-02 22:17:45 -05:00
toasted-nutbread
f89806e05d Simplify how anki errors are shown 2019-12-01 22:26:23 -05:00
toasted-nutbread
093fa3a437 Group public/private functions together 2019-12-01 22:21:10 -05:00
toasted-nutbread
4f7fa8474d Mark functions as private 2019-12-01 22:19:45 -05:00
toasted-nutbread
b4cdbf0263 Update how anki settings are updated 2019-12-01 22:16:58 -05:00
toasted-nutbread
3e1b080cd3 Simplify how anki templates are reset 2019-12-01 21:08:46 -05:00
toasted-nutbread
767a480a84 Organize main settings script 2019-12-01 17:02:01 -05:00
toasted-nutbread
a4de2d425a Move popup preview settings into new script 2019-12-01 17:02:01 -05:00
toasted-nutbread
65e9d47743 Move storage settings into new script 2019-12-01 17:02:01 -05:00
toasted-nutbread
69ba665a4f Move anki template settings into new script 2019-12-01 17:02:01 -05:00
toasted-nutbread
67990f4cb9 Move anki settings into new script 2019-12-01 16:19:15 -05:00
toasted-nutbread
3a517f0574 Move audio settings into new script 2019-12-01 16:19:15 -05:00
toasted-nutbread
ae94f84ffd Move settings scripts 2019-12-01 16:19:12 -05:00