Commit Graph

278 Commits

Author SHA1 Message Date
toasted-nutbread
05d4049f16
DOMParser replacement (#561)
* Add script to build library files

* Add built parse5 library

* Add new SimpleDOMParser which uses parse5

* Update license info

* Update MV3 build to use the new SimpleDOMParser

* Update file exclusions

* Hide/clarify license info for MV2 builds
2020-12-18 17:06:30 -05:00
toasted-nutbread
51223abfa6
Set up initial manifest v3 support (#605) 2020-12-18 15:54:05 -05:00
toasted-nutbread
c728448a4d
Maximum clipboard search length (#1118)
* Add maximumClipboardSearchLength an option

* Add setting

* Add limits

* Update tests
2020-12-18 11:24:43 -05:00
toasted-nutbread
ddb71af6bd
Add zuru deinflections (#1091)
* Update deinflector rule types

* Add deinflection rules for zuru verbs

* Add tests
2020-12-12 10:17:25 -05:00
toasted-nutbread
2484ba68d1
Add classic suru deinflection negative tests (#1090)
* Add negative tests for classic suru verbs

* Add missing test for non-negative classic: causative, potential or passive
2020-12-08 22:59:40 -05:00
toasted-nutbread
df9436bc3e
Add classic suru deinflections (#1089)
* Add classic suru deinflections

* Add tests
2020-12-08 22:39:06 -05:00
toasted-nutbread
2be81cbb77
Update/test deinflector (#1087)
* Update formatting

* Add missing rule for progressive/perfect

* Add adnomial -ki rule

* Update rules for irregular verbs

* Organize rules by rulesOut

For the most part, the order is:
  adj-i => v1 => v5 => vs => vk => other

* Add tests
2020-12-08 20:29:42 -05:00
toasted-nutbread
2910685a96
Database test updates (#1086)
* Remove unused

* Create DatabaseVM

* Update sequences in test dictionary

* Update documentation

* Add second valid testing dictionary

* Set up translator tests

* Write expected data
2020-12-08 20:27:36 -05:00
toasted-nutbread
35fbc76df4
Settings v2 testing setup (#1084)
* Add option for using settings v2

* Add options/info about settings v2

* Use settings v2 URL when applicable

* Update tests
2020-12-06 21:17:05 -05:00
toasted-nutbread
ae9a20e0de
Json schema improvements (#1078)
* Test multipleOf

* Refactor defaulting

* Use default if invalid for non-object/array properties

* Add tests
2020-11-30 18:56:28 -05:00
toasted-nutbread
34451ebf71
JapaneseUtil normalization (#1076)
* Use JapaneseUtil as a class which is manually instantiated

* Use alias function for toKana
2020-11-29 13:09:02 -05:00
toasted-nutbread
008ffdb6bf
Frequencies marker (#1074)
* Update japanese.js tests

* Simplify fallback/early exit

* Add overloads to furigana and furiganaPlain handlebars helper functions

* Expose unique expression/reading arrays (and subsequently counts)

* Add {frequencies} marker
2020-11-28 14:30:50 -05:00
toasted-nutbread
92e9f69c80
Popup style updates (#1066)
* Replace compactGlossaries option with new glossaryLayoutMode option

* Update attributes

* Update attributes

* Update color definitions

* Fix default theme scrollbar
2020-11-25 23:22:05 -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
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
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