Commit Graph

2005 Commits

Author SHA1 Message Date
toasted-nutbread
d66a5e3b87
Fix settings resetting not initializing dictionary settings properly (#1036) 2020-11-15 14:14:52 -05:00
toasted-nutbread
4b1c7b1e26
Display layout updates (#1032)
* Fix display scroll not always using the right position

* Update display layout and scroll method

* Fix border size
2020-11-14 18:12:06 -05:00
toasted-nutbread
af16643f35
Display styles update (#1030)
* Make section comments into single line comments

* Update :before/:after to be ::before/::after

* Organize and compact CSS

* Remove obsolete style

* Add padding var

* Use calc and var for layout units and common values

* Update search page styles
2020-11-14 15:23:20 -05:00
toasted-nutbread
50a1fbfb9f
Display updates (#1029)
* Simplify expression creation

* Add attribute indicating whether the reading is the same or not

* Update kanji debug info

* Remove some unnecessary null checks

* Simplify iterable check

* Update float and search HTML to be more consistent
2020-11-14 13:42:50 -05:00
toasted-nutbread
112f08a13e
Fix term details not using the expanded tags (#1028) 2020-11-14 12:09:14 -05:00
toasted-nutbread
20f3d09aa4
Clear cached definition when rendering a template (#1022) 2020-11-12 20:35:11 -05:00
toasted-nutbread
ec021964b7
Compact tags refactor (#1021)
* Update translator to flag redundant tags instead of remove

* Update how compact tags are shown in the popup

* Pass compactTags option to note builder

* Update options templates

* Add options upgrade

* Add options upgrade test
2020-11-12 20:34:11 -05:00
toasted-nutbread
eb8069a494
Options context updates (#1017)
* Update event order

* Update inputs

* Add type and cause to input info

* Update input info args

* Simplify arguments

* Update argument name

* Change order
2020-11-08 22:55:43 -05:00
toasted-nutbread
3a23f081d1
Frontend options override refactor (#1016)
* Update how options context overriding works

* Make function private
2020-11-08 22:49:40 -05:00
toasted-nutbread
8edb478d0a
Update keyboard/mouse modifiers to return an array rather than a set (#1015) 2020-11-08 22:19:54 -05:00
toasted-nutbread
681065e554
Remove unused functions from backend.js (#1014) 2020-11-08 17:06:44 -05:00
toasted-nutbread
16321a1f8c
Add duplicate check option (#1012)
* Add anki.checkForDuplicates option

* Use checkForDuplicates for button display

* Add property to card creation
2020-11-08 16:25:07 -05:00
toasted-nutbread
4e30409410
Add api.isAnkiConnected (#1011) 2020-11-08 15:53:06 -05:00
toasted-nutbread
0cbc6523e6
Remove unused default selected (#1010) 2020-11-08 14:24:39 -05:00
toasted-nutbread
6081e3bef0
Make query parser mode select in the base HTML (#1009) 2020-11-08 13:25:07 -05:00
toasted-nutbread
8dc961a61f
Merge QueryPaserGenerator into QueryParser (#1008) 2020-11-08 12:50:16 -05:00
toasted-nutbread
948605a1fe
Update query parser to properly display multi-line content (#1007) 2020-11-08 12:43:41 -05:00
toasted-nutbread
12e6e37785
Query parser generator refactor (#1006)
* Simplify select generation

* Refactor text generation

* Change optional argument

* Remove query-parser-templates.html

* Simplify prepare

* Simplify preview
2020-11-08 12:35:32 -05:00
toasted-nutbread
8cf10d685d
Search and display style updates (#1005)
* Use same selectors

* Use consistent stylesheet declaration

* Fix query parser not being cleared

* Set property upon load

* Don't focus for Enter key press

* Update search page styles

* Update indent and nodes

* Support dark style

* Add missing var
2020-11-08 12:34:23 -05:00
toasted-nutbread
db9ec4c449
Fix search tab opening having some errors (#1004) 2020-11-07 22:43:14 -05:00
toasted-nutbread
f4325b7db9
Fix byte count labels (#998)
* Add 'TB' label

* Prevent overflow

* Fix storage information on the old settings page
2020-11-07 09:58:46 -05:00
toasted-nutbread
9c6ff387a0
Popup preview update (#994)
* Add options.global.showPopupPreview option

* Add preview visibility control using a checkbox

* Add attribute on page load

* Disable animation until page is loaded
2020-11-06 22:14:00 -05:00
toasted-nutbread
b62c48822e
Use <strong> styling for list keys (#991) 2020-11-05 22:44:35 -05:00
toasted-nutbread
3216a9e263
Settings controller changes (#990)
* Make allowSecondarySearchesCheckbox optional

* Move getDictionaryInfo into SettingsController
2020-11-05 18:45:57 -05:00
toasted-nutbread
5b9d709d40
Conjugation marker (#988)
* Add {conjugation} marker

* Add info

* Add upgrade

* Update test
2020-11-04 20:39:23 -05:00
toasted-nutbread
255c8b724e
Pitch accents preview (#987)
* Add public preparePitchAccents function to DisplayGenerator

* Add pitch accents preview HTML, CSS, and JS
2020-11-03 22:30:20 -05:00
toasted-nutbread
a8ff38eec3
Fix display issues (#984)
* Remove unused function

* Update expresionMulti detection

* Simplify kanji early escape

* Simplify frequency/pitch data creation

* Update implementation of _buildTermMeta

* Update how pitch accents sources are collected

* Remove old _buildTermMeta
2020-11-01 21:24:35 -05:00
toasted-nutbread
215ef627f1
Duplicate scope options (#955)
* Add deck-root duplicate scope option

* Implement support for deck-root scope
2020-10-31 19:03:45 -04:00
toasted-nutbread
94620f4f22
Trigger event on property change (#979)
* Add _triggerScanInputsChanged function

* Trigger event when inputs are changed
2020-10-31 17:13:24 -04:00
toasted-nutbread
11c5dbac64
Add an 'other' option for when there is no matching main scanning input (#978) 2020-10-31 17:03:22 -04:00
toasted-nutbread
f78e243853
Update counts when an input entry is removed (#977) 2020-10-31 16:38:48 -04:00
toasted-nutbread
164c7b4375
Fix addition/removal of middle mouse button input not always working (#976) 2020-10-31 16:33:48 -04:00
toasted-nutbread
21cae0e38e
Scan inputs controller refactor (#975)
* Add public function to clear inputs

* Return the promise

* Pass input options directly

* Assign showAdvanced

* Add more menu options
2020-10-31 16:26:01 -04:00
toasted-nutbread
ab98caf842
Scanning inputs refactor (#974)
* Add support for count nodes

* Add support for menu button
2020-10-31 13:40:10 -04:00
toasted-nutbread
54768ca6e4
Update PopupPreviewController to support settings v2 (#972) 2020-10-30 22:21:56 -04:00
toasted-nutbread
f5d6573bec
Add supoprt for modal dimmer element (#971) 2020-10-30 22:20:50 -04:00
toasted-nutbread
327d7b1f26
Anki templates refactor (#970)
* Support menus with multiple sources

* Update anki templates controller
2020-10-30 17:41:52 -04:00
toasted-nutbread
cb76848df9
Fix profile creation not working on settings v1 (#968) 2020-10-28 20:47:20 -04:00
toasted-nutbread
890de095db
Fix modals not closing properly when the outside is clicked (#967) 2020-10-28 20:45:50 -04:00
toasted-nutbread
ba59327354
Dictionary controllers update (#965)
* Make purge notification optional

* Support multiple warning nodes

* Add support for optional count info
2020-10-27 21:20:26 -04:00
toasted-nutbread
9e57509e25
Json schema default value improvement (#964)
* Ensure value has property before using its value

* Add tests
2020-10-27 19:40:19 -04:00
toasted-nutbread
75734de7eb
Option schema default value info (#963)
* Add traversal info to getValidValueOrDefault

* Move private function
2020-10-27 19:27:27 -04:00
toasted-nutbread
dfdefc15d3
Options fixes (#962)
* Fix default options not having the correct versions

* Move schema validation

* Remove legacy version number

* Add tests for OptionsUtil.getDefault()

* Remove unused getValidValueOrDefault
2020-10-27 19:26:30 -04:00
toasted-nutbread
45627bd6e6
Fix class name (#961) 2020-10-27 19:24:17 -04:00
toasted-nutbread
502ca9c96e
Remove limits for popup horizontal/vertical offsets (#960) 2020-10-27 19:23:03 -04:00
toasted-nutbread
9048890bf6
Remove error type from error message (#958) 2020-10-26 21:54:18 -04:00
toasted-nutbread
28330d0e30
Anki controller refactor (#957)
* Add _setFieldMarker helper function

* Add support for persistent nodes

* Add support for menus
2020-10-25 22:51:28 -04:00
toasted-nutbread
92c083ee9f
Sort deck and model names in Anki card settings (#956) 2020-10-25 19:04:59 -04:00
toasted-nutbread
defd7402cf
Anki controller refactor (#954)
* Simplify data transform for anki.enable setting

* Refactor AnkiController

* Implement marker link clicking

* Request permissions for clipboard
2020-10-25 13:34:42 -04:00
toasted-nutbread
9e9bd0dcf6
Profile controller refactor (#953)
* Udpate selectors

* Optional remove button

* Add menu

* Refactor ProfileController

* Fix selector
2020-10-24 16:01:13 -04:00
toasted-nutbread
4188adae28
Rename index to profileIndex for clarity (#952) 2020-10-23 21:37:22 -04:00
toasted-nutbread
fcf63d71f5
Profile controller refactor (#950)
* Add additional fields for consistency

* Fix copy confirm not working correctly

* Update IDs
2020-10-20 22:15:11 -04:00
toasted-nutbread
9bda0a9eb4
Popup preview fixes (#948)
* Select just the text node and not its container

* Make background color transparent by default
2020-10-20 20:53:18 -04:00
toasted-nutbread
ecbac2c5ea
Popup preview improvements (#947)
* Move CSS

* Update indent

* Refactor HTML/CSS

* Add support for editing the source text

* Add WanaKana binding for input

* Rename file
2020-10-20 19:08:17 -04:00
toasted-nutbread
23230b8a7c
Backup controller refactor (#946)
* Update IDs

* Change how default fieldTemplates is assigned

* Ensure no missing fields

* Fix error display during import
2020-10-19 20:05:45 -04:00
toasted-nutbread
91b4feb934
Make dictionary spinner optional (#945) 2020-10-19 17:25:15 -04:00
toasted-nutbread
69e5ea6138
Popup menu updates (#942)
* Expose isClosed property

* Add popupMenu to detail

* Return true if closed, false otherwise

* Add closed event to PopupMenu
2020-10-18 19:48:44 -04:00
toasted-nutbread
9fa2ebddc8
Dictionary controller updates (#941)
* Rename action

* Store more state information

* Conditional checks for details toggle links

* Add support for hiding/showing details via menu
2020-10-18 19:35:09 -04:00
toasted-nutbread
ce17a47b5e
Change progress reporting to support settings v2 (#940) 2020-10-18 18:28:14 -04:00
toasted-nutbread
8bf42fa69e
Dictionary controller updates (#939)
* Check if element exists

* Add delete function

* Add support for deleting via popup menu

* Update how count visibility is updated

* Update dictionary deletion progress updates

* Update storage stats after dictionary deletion
2020-10-18 18:26:44 -04:00
toasted-nutbread
3e3c080a43
Status footer (#938)
* Add event for popup element close completion

* Add StatusFooter class
2020-10-18 18:22:36 -04:00
toasted-nutbread
a920445883
Fix focused element of popup menus (#937) 2020-10-18 18:21:10 -04:00
toasted-nutbread
988ea8f70a
Update audio controller for menus (#936)
* Make event non-async

* Only add event listener if the button exists

* Add support for menu for removal
2020-10-18 13:18:57 -04:00
toasted-nutbread
3ab63f4f55
Fix missing close cause (#935) 2020-10-18 13:00:49 -04:00
toasted-nutbread
82e203dd76
Popup menu updates (#934)
* Store a reference to the menu

* Allow close cancellation

* Add open event
2020-10-18 12:58:07 -04:00
toasted-nutbread
faf130f420
Add PopupMenu class (#933) 2020-10-18 12:49:51 -04:00
toasted-nutbread
054fe02808
Fix new Modal's base calss (#932) 2020-10-18 09:54:29 -04:00
toasted-nutbread
d35d1fd44a
Generalize modal, move to popup-elements.js (#931) 2020-10-18 09:39:55 -04:00
toasted-nutbread
6f1bdf0c66
Modal split (#930)
* Move jQuery-based modal into a separate class

* Remove jQuery conditions for default modal
2020-10-18 09:27:32 -04:00
toasted-nutbread
a4550627af
Add a refresh function to GenericSettingsController (#929) 2020-10-17 21:38:29 -04:00
toasted-nutbread
642c434829
SelectorObserver (#927)
* Create new SelectorObserver class

* Update DOMDataBinder to use SelectorObserver

* Update names to be more clear

* Remove attributeOldValue parameter, clarify attributes parameter

* Add documentation
2020-10-17 16:33:11 -04:00
toasted-nutbread
e5ef3fe9c2
Remove debug log (#924) 2020-10-15 18:10:29 -04:00
toasted-nutbread
e6a1bcc0f5
Ensure settings exist for all installed dictionaries (#922) 2020-10-14 19:38:50 -04:00
toasted-nutbread
51904761ce
Add simple scan input UI (#921)
* Add simple scan input UI

* Create helper function

* Add controller for old scanning input UI

* Add refresh functions

* Add abstraction function

* Fix incomplete middle mouse support detection

* Make scanning inputs update eachother

* Fix global declaration order
2020-10-14 19:37:46 -04:00
toasted-nutbread
429e3a5b74
Fix "modifier" field being required despite being deleted (#920) 2020-10-14 19:36:27 -04:00
toasted-nutbread
a72c3d7719
Fix template updates for multiple declarations (#918)
* Update pattern to be multi-match

* Remove unnecessary async
2020-10-14 19:35:13 -04:00
toasted-nutbread
3e9db71120
Add a default audio option (#913) 2020-10-11 22:20:07 -04:00
toasted-nutbread
5b5b45b88e
Dictionary controller refactor (#912)
* Support multiple main dictionary selects

* Update progress container

* Change class name

* Simplify dictionary info

* Update outdated node visibility

* Simplify node usage

* Simplify title

* Update classes

* Update IDs/classes

* Remove details container visibility assignment

* Use a template for dictionary details

* Fix progress bar visibility

* Fix incorrect property

* Rename dict-details to dictionary-details

* Remove unused classes

* Update class names for dictionary templates

* Rename templates

* More id renaming

* Remove unused id

* Rename more IDs
2020-10-11 17:31:58 -04:00
toasted-nutbread
9da08c7fe6
Generic settings improvements (#909)
* Add helper function _getElementRelativeToAncestor

* Move helper functions

* Add setVisibility transform

* Add support for data-transform attribute shorthand

* Add support for using the document element as the ancestor
2020-10-10 23:17:51 -04:00
toasted-nutbread
25c590e54b
Add modal controller class (#908)
* Add ModalController

* Use modalController instead of new Modal
2020-10-10 20:58:38 -04:00
toasted-nutbread
0244d07ea9
Storage controller refactor (#907)
* Use array for use/quota nodes

* Use classes instead of ids
2020-10-10 17:37:16 -04:00
toasted-nutbread
19e0346484
Further generalize storage controller by supporting lists of nodes (#906) 2020-10-10 17:31:09 -04:00
toasted-nutbread
199dd7d763
Storage controller refactor (#905)
* Use hidden instead of storage-hidden class

* Refactor storage events

* Make ID more generic

* Update how persistent storage is activated

* Add null checks

* Update HTML/ID

* Disallow disabling persistent storage

* Refactoring

* Update more IDs

* Disable multiple simultaneous stats updates

* Store node references

* Move undefined assignment
2020-10-10 16:54:52 -04:00
toasted-nutbread
3174f3c657
Update audio controller (#904)
* Remove redundant assignment of select value

* Update TTS preparation

* Don't hide options

* Improve voice sorting

* Update event handler

* Apply options to all selects targeting audio.textToSpeechVoice

* Update selector

* Use IDs

* Move test text to a hidden text input
2020-10-10 12:11:33 -04:00
toasted-nutbread
6799b87cc6
Make animation optional for Modal.setVisible (#903) 2020-10-10 10:47:02 -04:00
toasted-nutbread
591253d783
Add support for allowing modals to be display:none when not open (#902) 2020-10-10 10:12:53 -04:00
toasted-nutbread
1ae8fb4bfa
Modal updates 2 (#901)
* Fix incorrect visible value

* Focus element when visibility is set

* Add isVisible function
2020-10-08 22:44:55 -04:00
toasted-nutbread
bedcad6ab2
Update the Modal class to support non-jQuery modals (#900) 2020-10-08 22:31:58 -04:00
toasted-nutbread
41ead7a90a
Add additional transforms (#899) 2020-10-08 17:38:18 -04:00
toasted-nutbread
05e51a950e
Settings templates refactor (#897)
* Add template instantiation API to SettingsController

* Use SettingsController.instantiateTemplate
2020-10-07 21:23:42 -04:00
toasted-nutbread
cb1902eadd
Template handler update (#896)
* Rename TemplateHandler to HtmlTemplateCollection

* Rename _templateHandler to _templates

* Allow creation from both string and element

* Simplify setup of templates, don't throw errors on invalid ID
2020-10-07 20:47:44 -04:00
toasted-nutbread
bbb534eff5
Split source.js into two files (#894) 2020-10-07 18:31:28 -04:00
toasted-nutbread
1a91935dd7
Fix dictionary settings not being deleted when deleting a single dictionary (#893) 2020-10-06 23:00:00 -04:00
toasted-nutbread
cee64f91eb
Fix data inconsistencies (#891)
* Simplify variable name

* Add dictionaryNames array

* Update how the dictionary field is assigned

* Use "dictionary" instead of "title" for consistency

* Remove redundant dictionary name

* Use _expandTags to create pitch accent tags
2020-10-06 20:28:49 -04:00
toasted-nutbread
69f94f8cb8
Update merged definitions to have consistent structure (#890)
* Update comment about definitions type

* Add conversion to ensure consistent data structure
2020-10-06 19:31:53 -04:00
toasted-nutbread
7ce87c51b4
Don't add duplicate definitions (#889) 2020-10-05 22:50:10 -04:00
toasted-nutbread
0cfaa1a5a8
Dictionary definition structure fixes (#888)
* Restore support for tags without metadata

* Fix missing spread
2020-10-05 21:10:52 -04:00
toasted-nutbread
8c8c27001e
Fix incorrect definitions array being used for compatibility merged definitions (#887) 2020-10-04 22:21:16 -04:00
toasted-nutbread
54810510fa
Fix primary audio source (#886)
* Add abstraction: _getDefinitionPrimaryExpressionAndReading

* Reuse existing definitions in a sequence

* Revert change to related definition source/rawSource/sourceTerm

* Update _getDefinitionPrimaryExpressionAndReading to return best match
2020-10-04 22:04:44 -04:00
toasted-nutbread
2d3cf89b49
Fix doc comments for translation options (#885) 2020-10-04 19:36:21 -04:00
toasted-nutbread
c604a406f0
Translator organization (#884)
* Group reduction functions together

* Group simple helpers

* Add label comments

* Move core _findTerms functions to top

* Move _getSecondarySearchDictionaryMap and _getDictionaryPriority

* Move tag helpers

* Move _getTextOptionEntryVariants

* Move functions up

* Move functions up

* Update label comments
2020-10-04 19:33:22 -04:00
toasted-nutbread
8b8806484e
Add check to verify expressions are strings (#883) 2020-10-04 19:04:21 -04:00
toasted-nutbread
f904b3e11a
Add sourceTermExactMatchCount to prioritize exact expression matches (#882) 2020-10-04 18:54:03 -04:00
toasted-nutbread
561e36e88d
Translator definition source term (and other info) (#881)
* Add sourceTerm field to 'term' and 'termGrouped' definitions

* Fix comparison of expressions which are always the same

* Rename/restructure term info map

* Add source term

* Add sourceTerm to expressions array

* Reuse furiganaSegments

* Add helper function _createExpressionDetailsListFromTermInfoMap

* Add expressions array to termMergedByGlossary

* Add expressions to definition types 'term' and 'termGrouped'

* Rename expressionDetails* to termDetails*

* Correct the source/rawSource/sourceTerm for related sequenced definitions

* Simplify structure of sequencedDefinitions

* Remove TODO
2020-10-04 18:10:10 -04:00
toasted-nutbread
7e31dcca39
Move deinflection reasons setup to backend (#880)
* Move deinflection reasons setup to backend

* Remove async
2020-10-04 13:09:04 -04:00
toasted-nutbread
2bd82353e4
Translator options refactor (#879)
* Refactor internal options for findTerms to not use the settings object

* Move findTerms/findKanji options creation

* Deconstruct used options values to variables before any await calls

* Rename findTermsOptions to just options

* Add documentation comments

* Add type information about definitions
2020-10-04 12:54:55 -04:00
toasted-nutbread
86c64ac4c2
Translator refactoring (#878)
* Add helper function _getSecondarySearchDictionaryMap

* Use spreads instead of concat

* Create helper function for assigning disambiguation info

* Add _getTermTagsScoreSum helper

* Rename variables

* Move assignment of definition details

* Convert databaseDefinitions to standard definitions

* Move creation of definitions

* Always pass definitionsByGlossary directly to _mergeByGlossary

* Refactor how used definitions are tracked

* Change _mergeByGlossary parameters

* Simplify _mergeByGlossary

* Generate definition structure at the end of the function

* Add reusable function to clone a tag

* Restructure merged sub-definition creation

* Move setup of totalExpressionSet/totalReadingSet

* Track all definitions with matching glossary

* Move creation of definitionTags

* Update score calculation for multiple definitions

* Disambiguate function name

* Rename variables

* Add helper function _createMergedGlossaryTermDefinition

* Remove rarely used check for secondary search results

Unclear what the purpose was since it was almost never used

* Update data structure

* Rename function/variable

* Add helper functions _createMergedTermDefinition

* Assign expressionDetails to variable

* Add rawSource to grouped definitions

* Use shared function for creating unused definition entries

* Add helper function _createMapKey

* Refactor _createExpressionDetails

* Change argument order

* Add _getTagNamesWithCategory helper

* Optimize _compressDefinitionTags

* Add _createGroupedTermDefinition helper

* Add type information

* Use consistent order for term definition fields, add comments for omitted fields

* Remove unused index field

* Add helper function _createKanjiDefinition

* Update types

* Add frequencies/pitches arrays

* Update terms array setup

* Simplify for loop

* Remove redundant property assignment

* Simplify how deinflections with no definitions are ignored

* Ensure duplicates are removed

* Rename variable

* Add comments about duplicate data

* Refactor variable/parameter names

* Move functions

* Rename functions

* Rename variable

* Add dictionaryPriority field

* Simplify priority comparison

* Rename argument

* Optimize comparison function when dictionary priority is not needed

* Add length check

* Remove unused parameter

* Rename variables/parameters

* Rename dictionaries to enabledDictionaryMap

* Store compactTags/mainDictionary options to variables

* Refactor _getSearchableText
2020-10-04 11:12:15 -04:00
toasted-nutbread
ef333b6d72
Dictionary data structure improvements (#877)
* Simplify object structure of deinflections

* Modify existing array when removing duplicates

* Update _sortDefinitions to not return a value

* Use explicit argument value

* Use a Collator for string comparisons

* Simplify order comparison

* Improve tag creation and sanitization

* Switch .map to a for loop, skip null meta

* Add _createKanjiStat

* Move _sortDefinitions definition

* Fix kanji stat sorting

* Remove return value from _sortTags

* Add _sortKanji

* Add fast exits for sorting

* Add _sortDefinitionsByIndex

* Combine sort function

* Improve creation of kanji definition data

* Use "databaseDefinitions" instead of "definitions" to disambiguate

* Simplify

* Simplify further

* Simplify max length calculation

* More destructuring

* Use databaseDefinitions variable name

* Move _mergeBySequence body into _getSequencedDefinitions

* Use databaseDefinitions field name

* Move maxLength calculation

* Use shared _createTermDefinitionFromDatabaseDefinition

* Simplify map

* Move definition sorts for better consistency and less redundancy

* Move _createExpression function

* Update setup of sequenced definitions

* Simplify for loop
2020-10-02 17:59:14 -04:00
toasted-nutbread
6b6ee76550
Move searchTerms/searchKanji to front of object definitions (#873) 2020-09-27 11:53:07 -04:00
toasted-nutbread
3b6e3193ae
Fix data-setting attributes not being updated on index change (#872) 2020-09-27 11:47:56 -04:00
toasted-nutbread
cdd649ea3d
Add scan on touch move and prevent touch scroll options (#871)
* Add scanOnTouchMove/preventTouchScrolling scanning input options

* Add settings controls

* Support scanOnTouchMove in TextScanner

* Support preventTouchScrolling in TextScanner
2020-09-27 11:46:37 -04:00
toasted-nutbread
73dd578821
Add middle mouse prevention option (#868)
* Add preventMiddleMouse option to TextScanner

* Add preventMiddleMouse options

* Add options

* Apply preventMiddleMouse options
2020-09-26 19:24:21 -04:00
toasted-nutbread
9c7b9d6660
Fix page type never being detected as search page correctly (#867) 2020-09-26 18:47:58 -04:00
toasted-nutbread
c1b5976394
Scanning mouse button fixes (#866)
* Move mouse0 blocking during mousemove into options

* Update primary button detection
2020-09-26 17:51:52 -04:00
toasted-nutbread
f0fc4bfee6
Send message updates (#864)
* Use _sendMessageTab

* Move _sendMessageAllTabs next to _sendMessageTab

* Rename function

* Add and use _sendMessageTabIgnoreResponse

* Add and use _sendMessageIgnoreResponse

* Always include params

* Update function consistency
2020-09-26 13:47:09 -04:00
toasted-nutbread
cab5daa22e
Add clipboard-text Anki field (#863)
* Add clipboard-text anki field

* Add markers

* Update clipboard injection
2020-09-26 13:45:48 -04:00
toasted-nutbread
079307899f
Media utility refactor (#859)
* Move loadImageBase64 into DictionaryImporter

* Convert mediaUtility to a class

* Add getFileExtensionFromImageMediaType to MediaUtility

* Use MediaUtility instead of _getImageExtensionFromMediaType

* Use MediaUtility in ClipboardReader to validate images before reading
2020-09-26 13:42:31 -04:00
toasted-nutbread
0b51488f1f
Audio system refactor (#858)
* Refactor AudioUriBuilder

* Add downloadAudio function

* Refactor AudioSystem

* Update API usage

* Rename file

* Update scripts

* Add prepare calls
2020-09-26 13:41:26 -04:00
toasted-nutbread
7d78e8737f
Cache map improvements (#856)
* Update CacheMap API; get=>getOrCreate; add get; add set; add has

* Update tests

* Add more tests
2020-09-22 20:09:12 -04:00
toasted-nutbread
d395a2a6bf
ClipboardReader class (#854)
* Create ClipboardReader class

* Use ClipboardReader in Backend

* Update ClipboardMonitor to use ClipboardReader

* Replace _onApiClipboardImageGet call

* Assign clipboard reader browser
2020-09-20 15:10:57 -04:00
toasted-nutbread
edda4778ac
Delete old scanning options during update (#851) 2020-09-20 11:30:38 -04:00
toasted-nutbread
07c95c56ba
Fix _addFieldTemplatesBeforeEnd not being await'd (#850) 2020-09-20 00:35:56 -04:00
toasted-nutbread
7a8b7eb488
Fix typeof comparing against a string (#849) 2020-09-19 22:19:31 -04:00
toasted-nutbread
c868950385
Organize background script grouping/order (#847) 2020-09-19 21:37:47 -04:00
toasted-nutbread
a2e6de84af
Dictionary delete improvements (#844)
* Change where clearDatabaseCaches occurs

* Move dictionary deletion into the settings page

* Remove api.deleteDictionary
2020-09-19 17:17:33 -04:00
toasted-nutbread
1078ab99b7
Fix settings sanitization resulting in invalid data for the schema (#843) 2020-09-19 17:15:34 -04:00
toasted-nutbread
2ff4f83072
Modal refactor (#842)
* Add Modal class

* Use Modal class
2020-09-19 17:14:51 -04:00
toasted-nutbread
613c7ebf69
Remove border/margin/padding/pointerEvents from iframe (#841) 2020-09-19 17:13:34 -04:00
toasted-nutbread
2f4adbab2c
Handlebars sandbox (#612)
* Set up template renderer proxy

* Use proxy

* Remove unused handlebars script tags

* Update manifest
2020-09-18 21:16:39 -04:00
toasted-nutbread
613252e320
Remove unused handlebars script (#833) 2020-09-15 20:07:44 -04:00
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
f997f01742
Dictionary controller refactor (#831)
* Create new DictionaryController

* Update input disabling when modifying the database
2020-09-15 19:35:44 -04:00
toasted-nutbread
8d28477562
Fix default options missing profiles (#829)
* Add minItems requirement for profiles array

* Use minItems/maxItems for default value construction
2020-09-13 19:59:02 -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
8b033a1650
Profile controller refactor (#825)
* Add refresh function

* Create new ProfileController class
2020-09-13 18:42:37 -04:00
toasted-nutbread
621aa354e7
Add scan dictionary type filters (#822)
* Add options for searchTerms and searchKanji

* Add settings HTML

* Add options to TextScanner

* Update _search/_findDefinitions to include searchTerms/searchKanji args

* Update _searchAtFromMouseMove args

* Change argument structure for _searchAt

* Use scanning options for searchTerms and searchKanji
2020-09-13 13:25:03 -04:00
toasted-nutbread
b180ebc3bc
Settings upgrade and schema fixes (#823)
* Add missing defaults

* Always include touch input during upgrade
2020-09-13 13:16:56 -04:00
toasted-nutbread
5b49cf4398
Pointer events support (#819)
* Add option pointerEventsEnabled

* Add _pointerEventsEnabled option to TextScanner

* Add additional options

* Mouse pointer events

* Touch pointer events

* Pen pointer events
2020-09-13 11:33:10 -04:00
toasted-nutbread
efd0de6bc0
Add workaround for Firefox bug not detecting pen input type correctly (#820) 2020-09-13 11:28:13 -04:00
toasted-nutbread
c98aa9ad47
More scanning options (#815)
* Reorganize options

* Add advanced options

* Add a setting transform 'setRelativeAttribute'

* Add advanced options to HTML/CSS
2020-09-12 13:20:02 -04:00
toasted-nutbread
41db9ec89b
Use a grid layout for scanning inputs (#814) 2020-09-12 11:22:17 -04:00
toasted-nutbread
a5845df123
Add support for pointer event input detection (#810) 2020-09-11 16:57:57 -04:00
toasted-nutbread
6afbda8dfe
Settings scanning refactor (#809)
* Move option for scanning.touchInputEnabled, make advanced

* Rename
2020-09-11 16:14:32 -04:00
toasted-nutbread
0c2f0aa4eb
Fix adding new scanning inputs not working (#808) 2020-09-11 16:03:46 -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
a1729eb9ae
Input type filters (#806)
* Add options for scanning input types

* Move buttons in layout, refactor CSS

* Add options for input types

* Use input type filters

* Add _getMatchingInputGroupFromEvent

* Use input filters for touch events
2020-09-11 14:13:52 -04:00
toasted-nutbread
18634dca1a
Fix scanning inputs upgrade using the wrong format (#805) 2020-09-11 00:29:38 -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
3dd4822ab3
Anki note media injection move (#801)
* Move anki note media injection functionality into Backend

* Add marker/mode checks

* Remove media injection from AnkiNoteBuilder
2020-09-10 15:04:54 -04:00
toasted-nutbread
52b0feb255
Move TextToSpeechAudio to a separate file (#800) 2020-09-10 12:06:56 -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
17ebe6a754
Create abstraction class for parsing DOM (#798) 2020-09-10 11:30:01 -04:00
toasted-nutbread
58e5ddfde0
Generalize AnkiNoteBuilder to not use audioSystem directly (#796) 2020-09-09 21:07:18 -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
8408bee90a
Settings controller file renaming (#794)
* Rename SettingsBackup to BackupController

* Rename files to more closely match classes

* Improve organization of script imports
2020-09-09 17:37:58 -04:00
toasted-nutbread
0d00f7e1cf
Scanning input generalization (#789)
* Add inputs to options.scanning

* Update CSS for mouse buttons

* Update list counters

* Set up HTML/CSS

* Add input controller

* Use new inputs

* Include mouse buttons

* Update how button inputs are detected

* Add index/empty fields to the input details object

* Update none check for scanning modifier

* Remove old settings

* Remove unused global
2020-09-09 16:59:03 -04:00
toasted-nutbread
acb7ad32f3
Anki media injection move (#793)
* Update AnkiNoteBuilder to not store a reference to an AniConnect instance

* Use more consistent details format

* Organize options assignment

* Move media injection

* Inject images before injecting audio

* Make functions private

* Make static functions private
2020-09-09 16:57:35 -04:00
toasted-nutbread
c0a6849f98
Use common function for data URL mediatype/data extraction (#792) 2020-09-09 13:10:51 -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
2aa86cc5f8
Anki API refactor (#790)
* Add function guiBrowseNote

* Assign default server as null

* Use get/set properties for server/enabled

* Refactor option values

* Refactor createNote/Data functions to not use options format directly

* Use createNote for testing

* Add errors
2020-09-09 11:54:40 -04:00
toasted-nutbread
b687870a55
Delay hide option (#774)
* Add hideDelay option

* Add _clearSelection

* Use hideDelay

* Prevent repeated delayed selection clears

* Fix popup hide timer being cleared when the cursor is moved into the frame
2020-09-08 19:40:15 -04:00
toasted-nutbread
ab4dbacc4c
Move assignment of the operating system property (#786) 2020-09-08 19:36:15 -04:00
toasted-nutbread
46af4c9da4
Text scanner fixes and refactoring (#788)
* Fix incorrect argument being passed

* Clear causeCurrent

* Change cause string to a more general input object
2020-09-08 19:23:32 -04:00
toasted-nutbread
5af3c680e4
Fix modifier keys not being spread (#785) 2020-09-08 12:39:51 -04:00
toasted-nutbread
f7093b4c1a
Anki note clipboard marker (#780)
* Update fields reference

* Add support for adding clipboard images to anki notes

* Add handlebars templates

* Add markers

* Add markers to readme
2020-09-08 11:01:08 -04:00
toasted-nutbread
36fc5abae5
Modifier key refactor (#784)
* Add functions for getting keyboard key information

* Use os + DocumentUtil to get modifier key names

* Remove keyboard modifier info from environment info
2020-09-08 10:53:41 -04:00
toasted-nutbread
0a5e832dfd
Mouse inputs (#783)
* Add mouse icon

* Add _updateModifiers

* Add support for mouse button modifiers

* Improve names of mouse inputs

* Improve mouse input sorting

* Rename getModifierKeyStrings to getModifierInputStrings

* Refactor keyboard/mouse inputs into KeyboardMouseInputField
2020-09-07 20:12:43 -04:00
toasted-nutbread
59559fc560
Profile conditions fixes and improvements (#782)
* Fix operator changes

* Fix default value not changing during type change

* Fix incorrect display value being assigned

* Refactor _updateValueInput
2020-09-07 13:22:34 -04:00
toasted-nutbread
7a59ca2926
Update the functions for upgrading anki templates to be more reusable (#779) 2020-09-06 14:39:18 -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
b28241dbf2
Fix error handling for screenshot captures (#777) 2020-09-06 14:36:43 -04:00
toasted-nutbread
44f38c4dea
Popup window (#773)
* Add option usePopupWindow

* Add PopupWindow class

* Add support for creating PopupWindow
2020-09-05 22:03:35 -04:00
toasted-nutbread
2f8408ffcc
Text scanner refactor (#771)
* Create searchAt wrappers

* Add optional support for searching on the click event

* Update QueryParser to use TextScanner's searchOnClick functionality

* Move/rename searchAt

* Move pendingLookup checks

* Add 'searched' event to TextScanner

* Use common searched event for Frontend and QueryParser

* Move functions, make private
2020-09-05 21:43:19 -04:00
toasted-nutbread
dd8e32e7c4
Fix template renderer sandbox compatibility (#770)
* Use Object.prototype.hasOwnProperty.call instead of hasOwn

* Disable WebExtension and core.js APIs for template-renderer.js
2020-09-04 18:19:43 -04:00
toasted-nutbread
1cc9f4b1a4
Remove old conditions.js references (#769) 2020-09-04 18:12:33 -04:00
toasted-nutbread
d34f1eab02
Make fetchModifyHeaders private (#767) 2020-09-04 18:00:22 -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
8cd5a2f75f
Profile conditions cleanup (#768)
* Remove conditions.js

* Rename profile-conditions2.js to profile-conditions.js
2020-09-04 17:53:29 -04:00
toasted-nutbread
f3dd2270a5
Json schema profile conditions (#758)
* Add clearCache function

* Add upgrade

* Use schema-based profile condition validation

* Update profile conditions settings controller

* Remove unnecessary async

* Remove old

* Remove unused templates
2020-09-04 17:44:00 -04:00
toasted-nutbread
f0c974d319
Move generateId to core.js (#748) 2020-08-22 15:49:24 -04:00
toasted-nutbread
9fa0f2a56a
Move findTerms and findKanji functions into TextScanner (#747) 2020-08-22 14:40:44 -04:00
toasted-nutbread
c26c4ae0cb
Frontend initialization refactor (#737)
* Fix incorrect popup depth reassignment

* Rename variable

* Rename property

* Use explicit parameter values

* Refactor setupNestedPopups

* Refactor frontend initialization
2020-08-16 16:16:18 -04:00
toasted-nutbread
d582c7a0f8
JSON schema refactor (#731)
* Remove JsonSchema.clone

* Move createProxy function

* Group public properties first

* Create private version of getPropertySchema

* Mark functions as private

* Use non-static getValidValueOrDefault

* Mark private

* Make public validate function not take an info parameter

* Remove JsonSchema

* Add isValid function

* Use isValid for some tests

* Fix incorrect type
2020-08-15 17:23:09 -04:00
toasted-nutbread
d8649f40d5
JSON-schema-based profile conditions (#730)
* Add ProfileConditions class

* Add URL to VM

* Add new ProfileConditions tests
2020-08-15 17:22:23 -04:00
toasted-nutbread
587822c16e
More JSON schema improvements (#729)
* Add support for constant values

* Add contains check for arrays

* Add tests

* Simplify getValidValueOrDefault testing
2020-08-11 19:21:26 -04:00
toasted-nutbread
abfa0362dd
Remove leftover handlebars.js imports (#728) 2020-08-09 21:18:36 -04:00
toasted-nutbread
2a86d66092
DOM + DocumentUtil merge (#727)
* Add DOM functions to DocumentUtil

* Use DocumentUtil instead of DOM

* Remove DOM

* Move document-util.js into mixed
2020-08-09 21:07:11 -04:00
toasted-nutbread
9f8f83508e
Merge dictionary.js functions into Translator class (#726)
* Move dictFieldSplit

* Copy dictionary.js definitions into translator.js

* Convert to member functions

* Refactor names

* Remove dictionary.js

* Rename
2020-08-09 21:04:09 -04:00
toasted-nutbread
f502dd4f21
Search refactoring (#725)
* Rename node fields to disambiguate

* Change order
2020-08-09 21:03:11 -04:00
toasted-nutbread
486d44f719
Json schema improvements (#722)
* Add support for regex pattern testing

* Add tests

* Separate JsonSchemaProxyHandler statics into JsonSchemaValidator

* Use this instead of JsonSchemaValidator

* Make JsonSchemaValidator non-static

* Use cache map for regex
2020-08-09 14:18:59 -04:00
toasted-nutbread
fbe575c577
Fix a stray error printed due to not catching (#723) 2020-08-09 14:14:56 -04:00
toasted-nutbread
6da02c6eee
document.js refactor (#719)
* Refactor document.js into a class

* Move public functions first

* Rename private functions

* Rename

* Rename argument

* Use instance of DocumentUtil

* Update tests

* Refactor

* Rename (test-)document.js to (test-)document-util.js
2020-08-09 13:27:21 -04:00
toasted-nutbread
480e0e15e3
Translator refactor (#720)
* Move simple find sort into translator.js

* Remove unused

* Use direct reference to database

* Make field private

* Remove statics

* Convert functions to private

* Organize by public/private
2020-08-09 13:21:14 -04:00
toasted-nutbread
427cf99b9f
Remove unused dependencies on context.html (#718) 2020-08-09 13:20:48 -04:00
toasted-nutbread
e87cc5c37d
Query parser text scanner options refactor (#717)
* Add _setSelectedParser helper

* Update TextScanner internal options representation

* Update QueryParser internal options representation
2020-08-09 13:19:42 -04:00
toasted-nutbread
b3eb2cb1ef
Fix overlapping version checks (#716) 2020-08-09 13:17:15 -04:00
toasted-nutbread
8ee717cdf7
Persistent display mode (#714)
* Simplify calls using chrome.tabs.sendMessage and getMessageResponseResult

* Rename message handlers

* Move onMessage handler into Display

* Assign search popup mode which persists across refreshes

* Update clipboard monitor on the search page

* Remove mode param
2020-08-09 13:11:41 -04:00
toasted-nutbread
bdcdf9b1f5
Strip request origin (#710)
* Add web request permissions

* Create fetch wrapper that anonymizes the request

* Fix Firefox not supporting 'extraHeaders' option
2020-08-02 18:58:19 -04:00
toasted-nutbread
b1b33f8beb
Fix fetch requests (#708)
* Revert audio fetching functionality to use XMLHttpRequest

* Replace requestJson

* Replace requestJson

* Replace requestJson

* Replace requestJson and requestText

* Fix tests

* Include support for vulgar word searches

* Remove request.js
2020-08-02 13:30:55 -04:00
toasted-nutbread
838fd211c6
Pitch accent Anki field templates (#701)
* Template helper updates

* Add pitch data to exported field formatting data

* Reuse note data

* Add no-op

* Set up pitch accent templates

* Refactor version update functions

* Implement upgrade process for new Anki templates

* Consistency

* Update README and anki.js to have matching markers
2020-08-01 16:23:33 -04:00
toasted-nutbread
1e839cd230
More display refactoring (#697)
* Remove some unnecessary _setQuery calls

* Add support for forcing the query parser to be visible or hidden

* Move _setEventListenersActive calls

* Remove URL for kanji links

* Refactor _setContentTermsOrKanji

* Move search query text assignment into Display

* Move title updates into Display

* Move popup close calls

* Prevent infinite loop of extension unload events
2020-08-01 16:22:00 -04:00
toasted-nutbread
b52074b3f0
Options util (#700)
* Move options functions into a class

* Rename and privatize

* Organize by public/private

* Refactor to use async function

* Simplify update function signature

* Add comment for update

* Rename

* Copy _applyUpdates into _legacyProfileUpdateUpdateVersion

* Organize

* Move profile options updates

* Refactor update details

* Add async support

* Formatting
2020-08-01 11:46:35 -04:00
toasted-nutbread
f1e7288c11
Additional template renderer helpers (#699)
* Add spread function

* Add generic operator evaluation function

* Add variable get/set/scope functions

* Add isMoraPitchHigh function
2020-07-31 16:17:58 -04:00
toasted-nutbread
736d3c892e
Dictionary data utility class (#698)
* Create utility class for helping format dictionary data

* Change format
2020-07-30 20:45:52 -04:00
toasted-nutbread
313476aa92
Query parser fix (#695)
* Standardize setContent calls

* Rename _queryText to _fullQuery

* Move query parser into Display and update float.html

* Generalize params

* Add "full" parameter to maintain the original full query
2020-07-26 19:29:12 -04:00
toasted-nutbread
0512258c8e
Display scroll refactor (#694)
* Cache navigation header

* Create _focusEntry

* Update scroll restoration

* Require explicit entry focus index
2020-07-26 18:49:38 -04:00
toasted-nutbread
104650627d
Merge redundant toggle handling code (#693) 2020-07-26 16:53:24 -04:00
toasted-nutbread
fca0004597
Don't assign mode as a search parameter (#692) 2020-07-26 16:52:45 -04:00
toasted-nutbread
208217198e
Display history refactor (#691)
* Create DisplayHistory

* Change arguments for _setContentTermsOrKanji

* Set up history-driven content updates

* Use new history only

* Load definitions if missing

* Refactor definitions getting

* Add support for wildcards

* Move definitions setup

* Add events

* Allow state change even if there is no history state

* Update search page to use history

* Fix history overwriting

* Fix search page not seeing state chang events during prepare

* Update state if necessary

* Don't reassign query text if the same

* Remove DisplayContext

* Initialize with real history state

* Track URL

* Update DisplayHistory to support pseudo-history

* Configure history settings on search page

* Fix state

* Use full URL

* Change data format of setContent

* Rename details to content

* Update event arguments

* Fix animation

* Remove old state changes

* Clear content properly

* Remove set/clear content overrides

* Fix setting up event listeners for content clear

* Make clearContent private

* Make focus opt-in

* Validate source

* Add unloaded type

* Generalize content params

* Update how extension unload content is assigned

* Restore query blurring
2020-07-26 16:51:54 -04:00
toasted-nutbread
e153971cd4
Add eachUpTo function (#690) 2020-07-26 16:50:56 -04:00
toasted-nutbread
2ed2b22d49
Fix search popup mode (#687)
* Fix missing mode on search popup

* Remove mode update
2020-07-25 13:23:51 -04:00
toasted-nutbread
4a43b41f79
Set content refactor (#686)
* Simplify invoke

* Pass isTerms instead of type

* Update DisplaySearch.setContent to pass argument array

* Simplify argument object structure for setContent

* Move focus and disableHistory level

* Always include focus and disableHistory options

* Change disableHistory to history

* Pass source text to setContent

* Use consistent argument/object field order

* Remove unused previous field

* Combine logic for forward/back navigation
2020-07-25 09:58:06 -04:00
toasted-nutbread
3754c92041
Query parser refactor (#683)
* Rename files to better match class name

* Don't pass setContent to QueryParser; use a generic event instead
2020-07-24 16:03:11 -04:00
toasted-nutbread
99f5655e53
Update DisplaySearch.setContent/clearContent to close popups (#682) 2020-07-24 14:54:54 -04:00
toasted-nutbread
d7aaab685e
Dev dependencies updates (#679)
* Update eslint to 7.5.0

* Update eslint-plugin-no-unsanitized to 3.1.2

* Update fake-indexeddb to 3.1.1

* Rename DictionaryImporter.import to .importDictionary

Conflicts with o-unsanitized/method
2020-07-19 22:05:37 -04:00
toasted-nutbread
71b97c2019
Display refactoring (#674)
* Move setupNestedPopups to Display

* Move auto-play timer and delay into Display

* Move some message handler definitions into Display

* Move default optionsContext definition
2020-07-18 23:47:02 -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
d7f78c23b5
Script ready state change (#672)
* Update how backend/frontend ready states are awaited and signaled

* Log errors on the search page

* Update action name
2020-07-18 17:11:38 -04:00
toasted-nutbread
e696dc84a8
Refactor context-main.js (#671) 2020-07-18 16:45:57 -04:00
toasted-nutbread
c6c0126394
Content script ready checks (#670)
* Move ready checkout of Display

* Add function to wait until if a tab's content script is ready
2020-07-18 14:18:10 -04:00
toasted-nutbread
ffc0b6588e
Fix incorrect URL being used (#669) 2020-07-18 14:17:30 -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
f9c76efea0
Fix Anki CORS requests (#666) 2020-07-17 14:27:57 -04:00
toasted-nutbread
fc31e6fab5
Fix incorrect field name (#665) 2020-07-14 21:58:53 -04:00
toasted-nutbread
161888d9a3
Remove backend options context (#661)
* Add support for getting the current profile

* Explicitly use current options
2020-07-11 15:20:51 -04:00
toasted-nutbread
ec42a7e4d6
Message handler refactor (#660)
* Refactor searchQueryUpdate action

* Use standard message handler style

* Use name "promiseOrResult" for consistency

* Use standard message handler convention for Yomichan message handlers

* Use common message handler invoker
2020-07-11 15:20:00 -04:00
toasted-nutbread
6f49f426b5
Generalized frame connections (#654)
* Create FrameClient and FrameEndpoint

* Use new Frame* classes for Popup=>frame connection

* Update api.sendMessageToFrame and api.broadcastTab to include the sender's frameId

* Update FrameClient to store the frame's frameId
2020-07-08 19:58:06 -04:00
toasted-nutbread
295ffa6e54
Refactor DisplayFloat=>Frontend message passing (#652)
* Change getOrCreatePopup arguments to be an object

* Add ownerFrameId to popup and DisplayFloat

* Refactor DisplayFloat host action invocation

* Use CrossFrameAPI instead of window.postMessage

* Update popup closing functionality on the search page
2020-07-08 19:50:13 -04:00
toasted-nutbread
8f48a23a45
Display class refactoring (#650)
* Organize by public/private

* Don't access super class's private members

* Make _autoPlayAudioTimer private

* Refactor constructors

* Make functions private

* Organize by public/private

* Organize window message handlers

* Make fields private

* Refactor DisplaySearch constructor

* Make functions private

* Organize by public/private
2020-07-03 15:58:29 -04:00
toasted-nutbread
e30bab3324
Refactor text source map (#649)
* Use a null check instead of array check

* Convert statisc to non-private

* Use public source

* Add public function for getting the mapping
2020-07-03 15:57:17 -04:00
toasted-nutbread
e36bc8771f
Display refactor (#643)
* Remove statics

* Move orphan detection and error handling to Display

* Add clearContent function

* Add/use public get/set functions for optionsContext

* Add public getOptions

* Move interactive assignment

* Mark fields as private

* Mark functions as private

* Change stray getter into a function
2020-07-03 12:02:21 -04:00
toasted-nutbread
6ede83f293
Move private function definitions inside of IIFE (#641) 2020-07-03 12:00:13 -04:00
toasted-nutbread
897d85d1ac
Util refactor and fix (#638)
* Remove unused functions

* Fix clone function not being visible on the window object
2020-07-03 11:57:15 -04:00
toasted-nutbread
c13160d784
Page exit prevention refactor (#637)
* Add page exit prevention functionality to SettingsController

* Update dictionary controller to use new page exit prevention system

* Remove page-exit-prevention.js
2020-07-03 11:56:26 -04:00
toasted-nutbread
1d02013642
Make JsonSchemaProxyHandler.unconstrainedSchema public and non-configurable (#636) 2020-07-03 11:55:39 -04:00
toasted-nutbread
bc6d855f3d
Fix incorrect handlebars execution context in helpers (#645) 2020-06-29 19:02:35 -04:00
toasted-nutbread
a16a8f53e6
Rename GenericDatabase to Database (#634) 2020-06-28 17:29:16 -04:00
toasted-nutbread
441c23bf3b
Rename Database to DictionaryDatabase (#633) 2020-06-28 17:24:06 -04:00
toasted-nutbread
7590055d4e
Merge BackendEventHandler into Backend class (#632)
* Merge BackendEventHandler into Backend class

* Remove unused public functions
2020-06-28 17:22:44 -04:00
toasted-nutbread
5183fb575f
Backend refactor (#631)
* Mark fields as private

* Remove static

* Make functions private

* Create onCommand handler

* Group event handlers

* Move functions

* Merge _onOptionsUpdated and _applyOptions

* Rename event handler

* Move event handlers

* Remove _getOptionsSchema

* Move private functions
2020-06-28 14:59:01 -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
7b5dd5c310
Update browser compatibility and Edge detection (#629) 2020-06-28 12:40:02 -04:00
toasted-nutbread
cdf191336a
Clone function (#624)
* Add clone function

* Replace utilIsolate with clone

* Replace JsonSchema.isolate with clone function

* Include core.js for tests which use json-schema.js

* Update visisted set
2020-06-28 12:38:34 -04:00
toasted-nutbread
5bf805755a
Yomichan object separation (#627)
* Move "yomichan" object setup to a separate file

* Update script imports

* Align message handlers

* Rename Yomichan.prepare to Yomichan.ready

* Add new prepare function

* Improve isExtensionUrl
2020-06-28 11:26:43 -04:00
toasted-nutbread
6ee50b3c95
Make PopupFactory.prepare non-async (#625) 2020-06-25 18:32:29 -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