Commit Graph

2836 Commits

Author SHA1 Message Date
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
2f96218e33
Fix search page being focused when changing settings (#892) 2020-10-06 21:21:54 -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
50f2385aaf Release 20.9.28.0 2020-09-28 21:21:35 -07: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
f18c28e519
Fix displayDetails not being properly null checked (#865) 2020-09-26 13:48:06 -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
d27349207d
Add web-ext dev dependency (#861)
* Add web-ext dependency

* Specify extension directory

* Add command for testing web-ext lint
2020-09-26 13:44:47 -04:00
toasted-nutbread
5df78c6f3a
Add icons (#860)
* Add hamburger menu icon

* Add material down/right arrows
2020-09-26 13:43:47 -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
22932e02cb
Browser manifest updates (#840)
* Remove options_page

* Remove applications entry

* Update default content_security_policy

* Add browser-specific build variants

* Update default manifest

* Increase Firefox min version to 57
2020-09-26 13:40:09 -04:00
toasted-nutbread
c8b738ddf7
Remove unused toIterable function (#857) 2020-09-22 22:59:07 -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
29890f7625
Remove comments from . eslintrc.json (#853) 2020-09-20 12:16:59 -04:00
toasted-nutbread
943ec41336
Add tests for options updating (#852) 2020-09-20 11:33:12 -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
d3ed8f43a1
Add lint test to validate <script>s in HTML files (#848) 2020-09-19 21:57:11 -04:00
toasted-nutbread
c868950385
Organize background script grouping/order (#847) 2020-09-19 21:37:47 -04:00
toasted-nutbread
51d4e5b0ff
Dev/test script organization (#846)
* Move lint scripts

* Move dictionary-validate.js

* Move schema-validate.js

* Move createTestDictionaryArchive, remove yomichan-test.js

* Rename yomichan-util.js to util.js

* Move test/yomichan-vm.js to dev/vm.js

* Move getArgs into util.js (and fix name)

* Create test-all.js

* Update test-code script
2020-09-19 19:04:28 -04:00
toasted-nutbread
4293f73153
Remove window from performance object access (#845) 2020-09-19 18:41:13 -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