Commit Graph

291 Commits

Author SHA1 Message Date
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
toasted-nutbread
5f49f0fed2 Add tests 2020-04-18 21:33:14 -04:00
siikamiika
c992e7f920 add manual performance tests 2020-04-18 23:28:00 +03:00
siikamiika
fbaf50def1 support iframes inside open shadow dom 2020-04-18 23:28:00 +03:00
toasted-nutbread
9297eb45ae
Merge pull request #450 from toasted-nutbread/frequency-readings
Add support for filtering frequency metadata based on readings
2020-04-18 14:14:30 -04:00
siikamiika
8c16a6e580
Merge pull request #456 from siikamiika/parse-text-refactor
Parse text refactor
2020-04-17 01:32:01 +03:00
toasted-nutbread
bf971be15b
Merge pull request #444 from toasted-nutbread/unused-globals
Check for unused globals as part of CI
2020-04-13 18:55:19 -04:00
siikamiika
6cc87ec975 remove "fragment" from jp.convertReading variables 2020-04-13 22:59:56 +03:00
siikamiika
f93dc85710 assume and propagate strings for text parsing 2020-04-13 22:55:33 +03: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
ceb12ac415 Add support for filtering frequency metadata based on readings 2020-04-11 23:20:36 -04:00
toasted-nutbread
92f2466cff Add tests, remove logs 2020-04-11 16:53:29 -04:00
toasted-nutbread
e7abeb02a6 Add simple check to see if globals are unused 2020-04-10 18:45:16 -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
fb87b1ad69 Add tests 2020-04-10 12:31:06 -04:00
siikamiika
668be6224b add fake chrome.runtime.onMessage.removeListener 2020-04-05 19:57:37 +03:00
toasted-nutbread
3684a479c5
Merge pull request #424 from toasted-nutbread/dictionary-importer
Dictionary importer
2020-04-05 12:52:07 -04:00
toasted-nutbread
058f626efd
Merge pull request #423 from toasted-nutbread/text-source-map
Text source map
2020-04-05 12:51:56 -04:00
toasted-nutbread
f439d12718
Merge pull request #385 from toasted-nutbread/pitch-accents
Pitch accents
2020-04-05 12:51:27 -04:00
toasted-nutbread
a4c7d243f4 Add allowfullscreen="true" 2020-04-04 20:21:39 -04:00
toasted-nutbread
ae246093a9 Create some tests for fullscreen elements, <iframe>s, and shadow DOMs 2020-04-04 16:56:06 -04:00
toasted-nutbread
9052ab8ebd Move dictionary import functionality into a new class 2020-03-30 20:51:20 -04:00
toasted-nutbread
7225201fb6 Add tests 2020-03-28 18:25:56 -04:00
toasted-nutbread
ae84d13757 Create simplified source map class 2020-03-28 18:17:00 -04:00
toasted-nutbread
0d80fcdf86 Move Japanese utility functions out of display-generator.js 2020-03-28 10:47:02 -04:00
toasted-nutbread
93f7278586 Update dictionary schema to support pitch accent data 2020-03-28 10:25:11 -04:00
toasted-nutbread
780d23b749 Add more tests for convertReading 2020-03-21 14:12:22 -04:00
toasted-nutbread
77a2cc60e9 Move basic string/character testing functions into a mixed/js/japanese.js 2020-03-21 13:18:34 -04:00
toasted-nutbread
487d4b239b Add unit tests 2020-03-15 22:25:08 -04:00
toasted-nutbread
a267799cd9 Add some extra tests 2020-03-14 13:51:06 -04:00
toasted-nutbread
7e1e7d59cd Add error message checking 2020-03-14 13:51:06 -04:00
toasted-nutbread
701f73440c Add tests 2020-03-14 13:51:06 -04:00
toasted-nutbread
5837d273f6 Add script to validate and fix global declaration format 2020-03-10 22:40:33 -04:00
toasted-nutbread
0cd1f8f20a Add missing copyright comment 2020-03-08 21:31:18 -04:00
toasted-nutbread
9069bcb3fe Remove duplicate file 2020-03-08 21:30:37 -04:00
toasted-nutbread
421b60db0f
Merge pull request #387 from toasted-nutbread/yomichan-vm
Abstract Yomichan extension script execution
2020-03-04 21:24:39 -05:00
toasted-nutbread
7a51a0fbde Abstract Yomichan extension script execution 2020-03-02 22:20:47 -05:00
siikamiika
bd48d2f919 fix Yomichan core message issues 2020-03-02 10:35:46 +02:00
toasted-nutbread
7c615244f4
Merge pull request #375 from toasted-nutbread/document-tests
Document tests
2020-03-01 14:41:17 -05:00
toasted-nutbread
39f9bb1050 Remove hasOwn which is no longer necessary 2020-02-25 22:30:00 -05:00
toasted-nutbread
d87050bbbb Add missing copyright headers 2020-02-23 13:05:48 -05:00
toasted-nutbread
0f9f2e446d Clear timer variable 2020-02-23 11:44:24 -05:00
toasted-nutbread
bdb86e1713 Test seeking functions 2020-02-22 16:36:17 -05:00
toasted-nutbread
934c3239f2 Add some basic document tests 2020-02-22 15:53:55 -05:00
toasted-nutbread
6513a15b3b Fix shadowing 2020-02-22 14:54:57 -05:00
toasted-nutbread
e3cfb3fbc7 Fix test-schema.js 2020-02-22 14:53:02 -05:00
toasted-nutbread
418e7f9968 Update titles type 2020-02-22 14:43:06 -05:00
toasted-nutbread
a2b72dd3ab Update test-dictionary 2020-02-22 13:40:57 -05:00
toasted-nutbread
12e0923b63 Add some basic invalid dictionaries to test 2020-02-22 13:38:03 -05:00
toasted-nutbread
7b1a1480dc Add a timeout to clearDatabase
This will trigger in case something goes wrong and a database isn't closed.
2020-02-22 13:10:30 -05:00
toasted-nutbread
a54f44122a Update location of test dictionary data 2020-02-22 12:58:33 -05:00
toasted-nutbread
4daf3435c2 Update database test 2020-02-22 12:47:09 -05:00
toasted-nutbread
1e573f36c4 Test some errors 2020-02-19 20:00:44 -05:00
toasted-nutbread
a8b1e40a1e Close to prevent hangs 2020-02-19 19:59:24 -05:00
toasted-nutbread
7901a46721 Validate results of importDictionary 2020-02-19 18:46:27 -05:00
toasted-nutbread
2829c88e7d Add script to test database.js 2020-02-18 22:19:55 -05:00
toasted-nutbread
da079820e6 Add script to validate the test dictionary data against JSON schemas 2020-02-18 22:19:33 -05:00
toasted-nutbread
09ea007883 Add test dictionary data 2020-02-18 22:19:08 -05:00
toasted-nutbread
f2f4081d45 Use ? instead of %s 2020-02-17 22:39:25 -05:00
toasted-nutbread
dce5f7e1e5 Allow dictionary-validate to be require'd 2020-02-17 22:38:48 -05:00
toasted-nutbread
06480751a9 Create yomichan-test script to reduce repeated code 2020-02-17 22:31:28 -05:00
toasted-nutbread
7cbebf6897 Update how main is invoked 2020-02-17 22:30:16 -05:00
toasted-nutbread
174d9e7429 Add some basic unit tests for JSON schemas 2020-02-17 14:20:22 -05:00
toasted-nutbread
9c5ad3ea67
Merge pull request #346 from toasted-nutbread/dictionary-schemas
Dictionary schemas
2020-02-11 21:21:37 -05:00
toasted-nutbread
23ddf84c6d Add script for testing generic schemas 2020-02-08 13:14:30 -05:00
toasted-nutbread
8733e324ec Create script to validate dictionary files 2020-02-08 12:28:46 -05:00