Commit Graph

60 Commits

Author SHA1 Message Date
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
c61a87b152
API refactor (#532)
* Convert api.js into a class instance

* Use new api.* functions

* Fix missing binds

* Group functions with progress callbacks together

* Change style

* Fix API override not working
2020-05-24 13:30:40 -04:00
toasted-nutbread
3949db26d7
Text scanner refactor (#517)
* Fix return type

* Pass search function as a constructor argument

* Pass constructor as a details object

For consistency with other complex constructors and improved semantics.

* Convert _ignorePoints to a single optional function

* Organize functions

* Rename ignorePoints to ignorePoint
2020-05-08 19:05:50 -04:00
toasted-nutbread
33bd9682ea
Query parser refactor (#514)
* Make functions private

* Make fields private

* Organize
2020-05-07 19:41:27 -04:00
toasted-nutbread
4eeb879fb8
Remove search query parser inheritance (#509)
* Remove getMouseEventListeners override

* Use this._options instead of this.options

* Make QueryParser use composition instead of inheritance for TextScanner

* Remove repeat call to document.querySelector('#query-parser-content')
2020-05-06 19:36:42 -04:00
toasted-nutbread
bb2d9501af
Add apiModifySettings (#501)
* Update getProfile/getProfileFromContext to store this.options in a variable

* Add useSchema parameter to options getter functions

* Add apiModifySettings

* Use apiModifySettings instead of apiOptionsSet

* Remove apiOptionsSet

* Fix incorrect deleteCount check

* Require explicit scope for options

* Throw on invalid scope
2020-05-06 19:32:28 -04:00
siikamiika
7d7ff165ce
Extract textSource text inside TextScanner (#500)
* extract text inside TextScanner

* clone textSource before text extraction
2020-05-05 00:13:43 +03:00
toasted-nutbread
08ada6844a
Remove Frontend inheritance (#486)
* Make Frontend use composition instead of inheritance for TextScanner

* Use push instead of concat

* Update setOptions and setEnabled APIs

* Update how onWindowMessage event listener is added/removed

* Rename options to _options

* Use bind instead of arrow function

* Fix selection being cleared due to settings changes
2020-05-02 12:47:15 -04:00
toasted-nutbread
48c7010f4e
Frontend refactor (part 1) (#484)
* Remove _getVisualViewportScale

* Use super's mouse event listener definitions

* Remove redundant override

* Remove getTouchEventListeners override

* Rename Display.onSearchClear to onEscape

* Change onSearchClear to clearSelection and use an event

* Update how text is marked for selection and deselection

* Replace onError with yomichan.logError

* Update setEnabled to refresh all event listeners
2020-04-27 18:10:37 -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
siikamiika
8c16a6e580
Merge pull request #456 from siikamiika/parse-text-refactor
Parse text refactor
2020-04-17 01:32:01 +03:00
siikamiika
f93dc85710 assume and propagate strings for text parsing 2020-04-13 22:55:33 +03:00
siikamiika
c613321a73 move QueryParser.parseText to Backend 2020-04-13 14:53:24 +03:00
siikamiika
ba97e72c8b fix ignoreElements in QueryParser 2020-04-11 21:04:30 +03: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
siikamiika
2c4fd648db remove stubs 2020-03-21 22:13:07 +02:00
siikamiika
46c6ad98f3 use dependency injection in QueryParser
Also fix an issue with settings update triggering a lookup on unprepared
QueryParser.
2020-03-21 22:13:07 +02:00
siikamiika
962c2a381f apply all options on profile change 2020-03-21 22:13:07 +02:00
toasted-nutbread
64fc0349a1 Update global declarations 2020-03-10 22:40:35 -04:00
siikamiika
24d9001b14 fix options object location 2020-03-07 14:27:44 +02:00
siikamiika
387e93dbbc use docSentenceExtract in QueryParser 2020-03-07 14:20:08 +02:00
toasted-nutbread
7b97138ad1 Changed type returned by apiTextParseMecab to avoid using for in 2020-02-25 22:13:03 -05:00
toasted-nutbread
53220af68e Don't use innerHTML 2020-02-23 11:49:52 -05:00
toasted-nutbread
c3e7280365 Simplify ternary 2020-02-22 14:52:09 -05:00
toasted-nutbread
c8e7a1543e Remove unused 2020-02-11 22:25:48 -05:00
toasted-nutbread
e2ac478cb7 Define more globals 2020-02-11 22:22:16 -05:00
toasted-nutbread
4629fb3639 Change no-undef from off to error 2020-02-11 22:22:16 -05:00
siikamiika
9c98c631af fix async issues 2020-02-10 22:09:23 +02:00
siikamiika
6c63a17d66 query parser html templates 2020-02-10 21:19:18 +02:00
siikamiika
fa4004437d query parser: add toggle for term spacing 2020-01-25 02:57:57 +02:00
siikamiika
8292be92d8 use TextScanner in QueryParser 2020-01-16 23:22:38 +02:00
toasted-nutbread
0d7ccf25b8 Update license info URL 2020-01-01 12:00:31 -05:00
toasted-nutbread
899ef167d1 Update copyright 2020-01-01 12:00:00 -05:00
toasted-nutbread
dbd9a54149 Use string.split instead of Array.from 2019-12-08 16:01:29 -05:00
toasted-nutbread
bb334acab6 Use substring instead of slice 2019-12-08 16:01:29 -05:00
siikamiika
1bdef2e7c3 fix query parser 2019-12-05 22:19:40 +02:00
siikamiika
2e04f752a5 fix clicking on query parser 2019-11-28 16:08:19 +02:00
toasted-nutbread
5a1046bc90 Update arrow-parens to always 2019-11-26 22:06:27 -05:00
toasted-nutbread
df9e697fca Remove trailing commas 2019-11-26 22:06:27 -05:00
toasted-nutbread
ef833d2bea Use const rather than let where possible 2019-11-26 22:06:27 -05:00
toasted-nutbread
4110a848f5 Move additional utility functions to DOM 2019-11-26 18:59:52 -05:00
siikamiika
f625321650 refactor selected parser refreshing 2019-11-23 17:50:46 +02:00
siikamiika
933fd77957 remove async 2019-11-23 17:50:46 +02:00
siikamiika
707b039927 store local copy of selected parser
Options don't update early enough even after awaiting
2019-11-23 17:50:46 +02:00
siikamiika
9dff658640 add parser selection 2019-11-23 17:50:46 +02:00
siikamiika
b02a30a2fd explicit checks in while and if 2019-11-23 17:50:46 +02:00
siikamiika
f97877a209 promise improvements 2019-11-23 17:50:46 +02:00
siikamiika
b336ab3a9a use const 2019-11-23 17:49:25 +02:00
siikamiika
8d9a635d5c remove dead code 2019-11-23 17:48:03 +02:00
siikamiika
955e131f96 add parser selection options 2019-11-23 17:45:44 +02:00