Commit Graph

115 Commits

Author SHA1 Message Date
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
219dfb4917
Add a core deepEqual function (#1018)
* Add a core deepEqual function

* Add tests
2020-11-09 21:47:25 -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
7fa4782954
Return an error code when promise main() functions fail (#1002) 2020-11-07 11:34:14 -05:00
toasted-nutbread
0b003ef2c3
Add showPopupPreview to options test (#1001) 2020-11-07 11:31:38 -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
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
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
bbb534eff5
Split source.js into two files (#894) 2020-10-07 18:31:28 -04:00
toasted-nutbread
6b6ee76550
Move searchTerms/searchKanji to front of object definitions (#873) 2020-09-27 11:53:07 -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
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
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
943ec41336
Add tests for options updating (#852) 2020-09-20 11:33:12 -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
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
89a83a9ed3
Add tests for data: and blob: iframe URLs (#757) 2020-08-24 20:17:10 -04:00
toasted-nutbread
a96e1c20a7
Dynamic property (#749)
* Add DynamicProperty class

* Add tests for DynamicProperty
2020-08-22 17:50:56 -04:00
toasted-nutbread
1f564b94cb
XMLDocument handling (#738)
* Add tests for SVGs

* Add more null checks for Frontend._popup

* Use null popup when on an XMLDocument
2020-08-22 13:03:35 -04:00
toasted-nutbread
a9b16bd937
Fix profile conditions unit test using old JsonSchema (#735) 2020-08-15 17:26:13 -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
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
7b1838a282
Create dev utility class for some shared functionality (#724) 2020-08-09 21:00:37 -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
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
d856e4caac
CacheMap (#715)
* Create CacheMap class

* Add test
2020-08-09 13:15:56 -04:00
toasted-nutbread
04d47bf8a9
Build system changes (#721)
* Refactor manifest.json

* Change end-of-line convention for built plain-text files

* Ignore builds directory

* Mark the "dev" directory as using the node environment

* Create build script

* Register build scripts

* Remove old build script

* Fix 64x64 icon

* Add test to ensure manifest data is updated properly
2020-08-09 13:09:06 -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
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
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
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
244ab31bb2
Generic database (#600)
* Update test

* Rename db to _db

* Create GenericDatabase class

* Catch prepare error

* Allow database to be purged even if it was not open

* Remove unused functions

* Change static functions to non-static

* Delete and count using the media object store

* Update tests
2020-06-21 16:12:56 -04:00
toasted-nutbread
e23504613f
Use DOMTextScanner (#536)
* Use DOMTextScanner instead of TextSourceRange.seek*

* Move getNodesInRange to dom.js

* Move anyNodeMatchesSelector to dom.js

* Remove unused functions

* Update tests

* Add layoutAwareScan option

* Use layoutAwareScan for source and sentence scanning

* Remove unused IGNORE_TEXT_PATTERN
2020-06-21 16:07:51 -04:00
toasted-nutbread
8a7ff6a18c
Replace XMLHttpRequest (#562)
* Replace XMLHttpRequest with fetch

* Implement fetch placeholder for tests
2020-06-13 10:23:04 -04:00
toasted-nutbread
f85508a25e
Simplify shadow test and add an open shadow DOM test (#533) 2020-05-10 14:09:04 -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
d6ae322961
Text scanning update (#507)
* Fix unity test missing a parameter

* Update docSentenceExtract to not rescan content
2020-05-06 19:34:32 -04:00
toasted-nutbread
f7df6254d6
Dom text scanner fixes (#505)
* Fix test case

* Add test-dom-text-scanner

* Ensure that DOMTextScanner._node never becomes null

* Add remainder
2020-05-06 19:33:17 -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
d4ae9aa501
DOMTextScanner (#458)
* Create new class for scanning text in a document

* Update test styles

* Add tests
2020-05-02 13:05:43 -04:00
toasted-nutbread
401fe9f8d0
Object property accessor API update (#485)
* Simplify function names

* Add delete and swap functions

* Remove custom setter

Not currently part of the expected use cases.

* Add documentation

* Update tests

* Add delete test functions

* Update tests to use fresh objects

* Add swap test functions

* Add empty tests

* Disable delete on arrays
2020-05-02 12:57:42 -04:00
toasted-nutbread
5b96559df8
Error logging refactoring (#454)
* Create new logging methods on yomichan object

* Use new yomichan.logError instead of global logError

* Remove old logError

* Handle unhandledrejection events

* Add addEventListener stub

* Update log function

* Update error conversion to support more types

* Add log event

* Add API log function

* Log errors to the backend

* Make error/warning logs update the badge

* Clear log error indicator on extension button click

* Log correct URL on the background page

* Fix incorrect error conversion

* Remove unhandledrejection handling

Firefox doesn't support it properly.

* Remove unused argument type from log function

* Improve function name

* Change console.warn to yomichan.logWarning

* Move log forwarding initialization into main scripts
2020-04-26 16:55:25 -04:00
toasted-nutbread
a761e42084 Update tests 2020-04-22 21:37:28 -04:00
toasted-nutbread
99c1a6a6bc Change some test variables using 'source' instead of 'content' 2020-04-19 10:57:33 -04:00