Commit Graph

226 Commits

Author SHA1 Message Date
toasted-nutbread
be590004fe
Text scanner improvements (#1261)
* Add support for allowing TextScanner.search to force focus

* Simplify query parser searched event forwarding

* Defer fallback creation

* Simplify event listeners

* Change type to pointerType

* Change cause to eventType

* Change empty to passive; make .search function passive

* Remove unused input index
2021-01-17 11:43:05 -05:00
toasted-nutbread
b7c9fa1057
Refactor note document title (#1227)
* Pass url into setContent

* Update where url is checked from

* Add documentTitle to state information

* Update how _getNoteContext gets the document title

* Update how url is fetched for options context

* Pass document title in to 'searched' event
2021-01-12 18:04:26 -05:00
toasted-nutbread
983e2c7936
Refactor text scanner options context generation (#1225)
* Refactor how options context is created and updated

* Udpate TextScanner/QueryParser to use getSearchContext instead of getOptionsContext
2021-01-11 23:13:35 -05:00
toasted-nutbread
f6a38f40dc
Customizable sentence parsing (#1217)
* Add new sentenceParsing options

* Update TextScanner.setOptions

* Assign terminator/quote maps

* Pass sentence parsing info to extractSentence

* Simplify setting

* Add setting for enableTerminationCharacters

* Create new settings for sentence termination characters
2021-01-10 14:43:06 -05:00
toasted-nutbread
083da93142
Refactor sentence parsing (#1215)
* Rename sentenceExtent with sentenceScanExtent

* Update TextScanner.setOptions

* Change function argument order

* Rename quote map variables

* Fix edge case quote handling

* Update terminator maps to support character inclusion
2021-01-09 23:10:55 -05:00
toasted-nutbread
da1e1e5c5b
Sentence parsing options (#1214)
* Rename options.anki.sentenceExt to options.sentenceParsing.scanExtent

* Create sentence parsing icon

* Create new sentence parsing section
2021-01-09 21:25:04 -05:00
toasted-nutbread
a02891e52c
Update copyright year (#1194)
* Update copyright year

* Remove redundant Author info
2021-01-01 14:50:41 -05:00
toasted-nutbread
ad90bad057
Display profile panel (#1178)
* Expose Display.displayGenerator

* Update search when assigning options context

* Don't clear selection unless the popup changes

* Merge search styles

* Create panel for changing the profile
2020-12-29 23:38:44 -05:00
toasted-nutbread
125c296eed
Support frame resize on firefox (#1088)
* Add popup functions for getting/setting the frame size

* Add frontend functions for getting/setting popup frame size

* Expose display mode attribute on display HTML

* Disable resizer on iframe

* Add custom frame resizer handle

* Add support for custom frame resizer
2020-12-08 20:31:02 -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
01ff7436ee
Popup setup refactoring (#1054)
* Pass childrenSupported as a parameter to Frontend/Popup constructors

* Remove setChildrenSupported

* Use event listener instead of function override

* Update options order

* Expand options and use object for clarity

* Fix childrenSupported not being fully propagated
2020-11-23 15:23:47 -05:00
toasted-nutbread
7234cce4ae
Refactor nested popup/frontend setup (#1052) 2020-11-22 11:19:21 -05:00
toasted-nutbread
c387898902
Display fixes (#1033)
* Fix an entry not always being focused

* Fix typo

* Fix copy action not working on Firefox
2020-11-14 21:47:43 -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
3a23f081d1
Frontend options override refactor (#1016)
* Update how options context overriding works

* Make function private
2020-11-08 22:49:40 -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
ecbac2c5ea
Popup preview improvements (#947)
* Move CSS

* Update indent

* Refactor HTML/CSS

* Add support for editing the source text

* Add WanaKana binding for input

* Rename file
2020-10-20 19:08:17 -04:00
toasted-nutbread
2f96218e33
Fix search page being focused when changing settings (#892) 2020-10-06 21:21:54 -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
9c7b9d6660
Fix page type never being detected as search page correctly (#867) 2020-09-26 18:47:58 -04:00
toasted-nutbread
ad8e9fe8e2
Add missing null check (#836) 2020-09-17 20:22:29 -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
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
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
e3a7678769
Anki screenshot refactor (#791)
* Use more consistent style for injectScreenshot

* Move screenshot generation into AnkiNoteBuilder/Backend

* Get optionsContext before await
2020-09-09 12:54:59 -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
44f38c4dea
Popup window (#773)
* Add option usePopupWindow

* Add PopupWindow class

* Add support for creating PopupWindow
2020-09-05 22:03:35 -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
4cd1676ddc
Handle error if _waitForFrontendReady fails when creating a popup proxy (#760) 2020-09-04 17:55:25 -04:00
toasted-nutbread
773e28aa3c
Fix screenshot popup hide (#753)
* Refactor Popup.setVisibleOverride

* Use event to observe visibility changes

* Add setAllVisibleOverride/clearAllVisibleOverride

* Add setAllVisibleOverride/clearAllVisibleOverride cross frame handlers

* Update how visibility is changed

* Wait for next frame to ensure visibility has been updated
2020-08-23 15:18:41 -04:00
toasted-nutbread
f0c974d319
Move generateId to core.js (#748) 2020-08-22 15:49:24 -04:00
toasted-nutbread
9fa0f2a56a
Move findTerms and findKanji functions into TextScanner (#747) 2020-08-22 14:40:44 -04:00
toasted-nutbread
1dc35dd6f1
Popup factory proxy creation (#745)
* Change getOrCreatePopup to async

* Rename parentFrameId to frameId, expose frameId property

* Update how proxy popups are created
2020-08-22 14:33:41 -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
c26c4ae0cb
Frontend initialization refactor (#737)
* Fix incorrect popup depth reassignment

* Rename variable

* Rename property

* Use explicit parameter values

* Refactor setupNestedPopups

* Refactor frontend initialization
2020-08-16 16:16:18 -04:00
toasted-nutbread
4d6851ec32
Refactor some frontend cross-frame communication (#733)
* Refactor iframe proxy setup

* Simplify document title acquisition
2020-08-15 17:36:42 -04:00
toasted-nutbread
d5865db457
Popup API refactor (#732)
* Simplify how parent/child are set

* Remove unused public frameId property

* Change use of getFrame

* Simplify parent access

* Use property for the container

* Remove isProxy

* Public function API parity

* Public property API parity
2020-08-15 17:27:03 -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
1184320e3e
Button and image scanning (#705)
* Update TextSourceElement.equals check to match TextSourceRange.equals

* Force full query to be visible when scanning buttons or images with more text

* Update style of query parser
2020-08-02 18:59:35 -04:00
toasted-nutbread
0512258c8e
Display scroll refactor (#694)
* Cache navigation header

* Create _focusEntry

* Update scroll restoration

* Require explicit entry focus index
2020-07-26 18:49:38 -04:00
toasted-nutbread
208217198e
Display history refactor (#691)
* Create DisplayHistory

* Change arguments for _setContentTermsOrKanji

* Set up history-driven content updates

* Use new history only

* Load definitions if missing

* Refactor definitions getting

* Add support for wildcards

* Move definitions setup

* Add events

* Allow state change even if there is no history state

* Update search page to use history

* Fix history overwriting

* Fix search page not seeing state chang events during prepare

* Update state if necessary

* Don't reassign query text if the same

* Remove DisplayContext

* Initialize with real history state

* Track URL

* Update DisplayHistory to support pseudo-history

* Configure history settings on search page

* Fix state

* Use full URL

* Change data format of setContent

* Rename details to content

* Update event arguments

* Fix animation

* Remove old state changes

* Clear content properly

* Remove set/clear content overrides

* Fix setting up event listeners for content clear

* Make clearContent private

* Make focus opt-in

* Validate source

* Add unloaded type

* Generalize content params

* Update how extension unload content is assigned

* Restore query blurring
2020-07-26 16:51:54 -04:00
toasted-nutbread
4a43b41f79
Set content refactor (#686)
* Simplify invoke

* Pass isTerms instead of type

* Update DisplaySearch.setContent to pass argument array

* Simplify argument object structure for setContent

* Move focus and disableHistory level

* Always include focus and disableHistory options

* Change disableHistory to history

* Pass source text to setContent

* Use consistent argument/object field order

* Remove unused previous field

* Combine logic for forward/back navigation
2020-07-25 09:58:06 -04:00
toasted-nutbread
e493cbc998
Simplify Popup.showContent API to use only two details arguments (#684) 2020-07-24 17:34:53 -04:00
toasted-nutbread
dac33e6961
Extension unload indication fix (#662)
* Remove unused function

* Rename field

* Change extensionUnloaded trigger function

* Update how extension unloaded content is shown

* Ignore certain errors caused by extension unload

* Add _showExtensionUnloaded function

* Wrap internals of updateOptions

* Suppress errors caued by extension unload

* Make the frontend trigger the popup's extensionUnloaded event
2020-07-18 14:15:36 -04:00
toasted-nutbread
ec42a7e4d6
Message handler refactor (#660)
* Refactor searchQueryUpdate action

* Use standard message handler style

* Use name "promiseOrResult" for consistency

* Use standard message handler convention for Yomichan message handlers

* Use common message handler invoker
2020-07-11 15:20:00 -04:00