Commit Graph

62 Commits

Author SHA1 Message Date
toasted-nutbread
a02891e52c
Update copyright year (#1194)
* Update copyright year

* Remove redundant Author info
2021-01-01 14:50:41 -05:00
toasted-nutbread
889240311b
Improve tag scanning behaviour (#1189)
* Update include/exclude selectors for Display._definitionTextScanner

* Fix missing condition
2020-12-31 14:21:50 -05:00
toasted-nutbread
068b1eef71
Text scanner improvements (#1056)
* Only ignore nodes on non-web pages

* Fix issue where options might not be assigned on nested frontends

* Refactor default TextScanner options

* Add option to enable search only on click

* Simplify restore state assignment

* Update options context passing

* Fix empty title

* Use TextScanner to scan content inside of Display

* Rename ignoreNodes to excludeSelector(s)

* Fix options update incorrectly triggering a re-search

* Fix copy throwing an error on the search page

* Replace _onSearchQueryUpdated with _search

* Use include selector instead of exclude selector
2020-11-23 20:31:48 -05:00
toasted-nutbread
f2ad94e54f
Text scanning options propagation (#1020)
* Update Display.setOptionsContext to update options

* Update how options context is updated in Popup

* Omit optionsContext for some _showPopupContent calls

* Remove extension unload

* Disable modifier keys in frontend's options context

* Update how text scanner passes modifiers to options context

* Update how options context is passed to display

* Update how display uses options context
2020-11-12 20:32:46 -05:00
toasted-nutbread
eb8069a494
Options context updates (#1017)
* Update event order

* Update inputs

* Add type and cause to input info

* Update input info args

* Simplify arguments

* Update argument name

* Change order
2020-11-08 22:55:43 -05:00
toasted-nutbread
8edb478d0a
Update keyboard/mouse modifiers to return an array rather than a set (#1015) 2020-11-08 22:19:54 -05:00
toasted-nutbread
6f980d8f2b
Text source range refactor (#949)
* Rename functions for better clarity

* Remove unused properties

* Add getNodesInRange function

* Improve ignore nodes check

* Use private fields
2020-10-20 20:54:26 -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
621aa354e7
Add scan dictionary type filters (#822)
* Add options for searchTerms and searchKanji

* Add settings HTML

* Add options to TextScanner

* Update _search/_findDefinitions to include searchTerms/searchKanji args

* Update _searchAtFromMouseMove args

* Change argument structure for _searchAt

* Use scanning options for searchTerms and searchKanji
2020-09-13 13:25:03 -04:00
toasted-nutbread
a12c4a1dd7
Add workaround for Firefox bug not detecting pen input type correctly (#821) 2020-09-13 11:58:07 -04:00
toasted-nutbread
5b49cf4398
Pointer events support (#819)
* Add option pointerEventsEnabled

* Add _pointerEventsEnabled option to TextScanner

* Add additional options

* Mouse pointer events

* Touch pointer events

* Pen pointer events
2020-09-13 11:33:10 -04:00
toasted-nutbread
fcb8806717
Fix location of _enabled assignment (#818) 2020-09-12 19:42:09 -04:00
toasted-nutbread
9f1753a565
Update TextScanner.setEnabled to not reset state if unnecessary (#817) 2020-09-12 19:36:51 -04:00
toasted-nutbread
568775c6dc
Text scanner cause update (#813)
* Rename _searchAtFromMouse to _searchAtFromMouseMove

* Rename cause 'mouse' to 'mouseMove' for clarity
2020-09-11 22:46:41 -04:00
toasted-nutbread
e56674e4ee
Text scanner refactoring (#812)
* Add functions _onPrimaryTouchStart and _onPrimaryTouchEnd

* Add "type" to input details
2020-09-11 20:24:51 -04:00
toasted-nutbread
6e7b9fcf99
Clear state when refreshing enabled state (#811) 2020-09-11 18:44:53 -04:00
toasted-nutbread
a1729eb9ae
Input type filters (#806)
* Add options for scanning input types

* Move buttons in layout, refactor CSS

* Add options for input types

* Use input type filters

* Add _getMatchingInputGroupFromEvent

* Use input filters for touch events
2020-09-11 14:13:52 -04:00
toasted-nutbread
0d00f7e1cf
Scanning input generalization (#789)
* Add inputs to options.scanning

* Update CSS for mouse buttons

* Update list counters

* Set up HTML/CSS

* Add input controller

* Use new inputs

* Include mouse buttons

* Update how button inputs are detected

* Add index/empty fields to the input details object

* Update none check for scanning modifier

* Remove old settings

* Remove unused global
2020-09-09 16:59:03 -04:00
toasted-nutbread
b687870a55
Delay hide option (#774)
* Add hideDelay option

* Add _clearSelection

* Use hideDelay

* Prevent repeated delayed selection clears

* Fix popup hide timer being cleared when the cursor is moved into the frame
2020-09-08 19:40:15 -04:00
toasted-nutbread
46af4c9da4
Text scanner fixes and refactoring (#788)
* Fix incorrect argument being passed

* Clear causeCurrent

* Change cause string to a more general input object
2020-09-08 19:23:32 -04:00
toasted-nutbread
c1b16cebe7
Refactor how TextScanner's public search() function is used (#787) 2020-09-08 18:52:23 -04:00
toasted-nutbread
55770934f8
Fix touch input always being disabled (#772) 2020-09-05 21:44:05 -04:00
toasted-nutbread
2f8408ffcc
Text scanner refactor (#771)
* Create searchAt wrappers

* Add optional support for searching on the click event

* Update QueryParser to use TextScanner's searchOnClick functionality

* Move/rename searchAt

* Move pendingLookup checks

* Add 'searched' event to TextScanner

* Use common searched event for Frontend and QueryParser

* Move functions, make private
2020-09-05 21:43:19 -04:00
toasted-nutbread
9fa0f2a56a
Move findTerms and findKanji functions into TextScanner (#747) 2020-08-22 14:40:44 -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
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
e87cc5c37d
Query parser text scanner options refactor (#717)
* Add _setSelectedParser helper

* Update TextScanner internal options representation

* Update QueryParser internal options representation
2020-08-09 13:19:42 -04:00
toasted-nutbread
f2991fb9ee
Frontend initialization refactor (#610)
* Create member functions for ignoreElements and ignorePoint

* Create addFullscreenChangeEventListener utility

* Move popup creation management into Frontend

* Move getUrl implementation

* Remove old setup

* Remove try/catch block

* Error wrap

* Add prepare call to TextScanner

* Update depth when popup changes

* Refactor how Frontend gets PopupFactory and frameId

* Update popup preview to work

* Update popup preview frame to use the frontend's popup

* Update how nested popups are set up

* Error wrap

* Update how popups are set up on the search page

* Error wrap

* Error unwrap

* Add missing prepare

* Remove use of frontendInitializationData

* Catch and log errors
2020-06-21 16:14:05 -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
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
b972f8cbf6
Text scanner refactor (#515)
* Mark functions as private

* Mark fields as private

* Add getter/setters for publicly used fields

* Replace public static functions with private non-static functions

* Update comment
2020-05-07 19:45:08 -04:00
siikamiika
a1f8f0d1de
support meta as scanning modifier (#502) 2020-05-05 00:14:21 +03: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
siikamiika
77b744e675
Modifier key profile condition (#487)
* update Frontend options on modifier change

* add modifier key profile condition

* use select element for modifier condition value

* support "is" and "is not" modifier key conditions

* use plural

* remove dead null check

it's never null in that function

* pass element on rather than assigning to this

* rename event

* remove Firefox OS key to Meta detection

* hide Meta from dropdown on Firefox

* move input type
2020-05-03 04:39:24 +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
e6053eefa5
Merge pull request #439 from siikamiika/popup-live-toggle
Popup live toggle
2020-04-17 01:31:25 +03:00
toasted-nutbread
778d49f86b
Merge pull request #443 from toasted-nutbread/fix-get-selection
Fix getSelection not working in QueryParser
2020-04-12 11:42:56 -04:00
siikamiika
5c3641eadb simplify frontend disable override 2020-04-11 21:04:30 +03:00
siikamiika
565e3a8c6a change iframe popup live 2020-04-11 21:04:30 +03:00
siikamiika
1df59d57b5 limit popup depth live 2020-04-11 21:01:27 +03:00
toasted-nutbread
2c5bf0ed6b Fix getSelection not working in QueryParser 2020-04-10 17:11:41 -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
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
toasted-nutbread
0c8f567e6d Fix indentation 2020-02-22 14:52:09 -05:00