Commit Graph

132 Commits

Author SHA1 Message Date
toasted-nutbread
313476aa92
Query parser fix (#695)
* Standardize setContent calls

* Rename _queryText to _fullQuery

* Move query parser into Display and update float.html

* Generalize params

* Add "full" parameter to maintain the original full query
2020-07-26 19:29:12 -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
2ed2b22d49
Fix search popup mode (#687)
* Fix missing mode on search popup

* Remove mode update
2020-07-25 13:23:51 -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
3754c92041
Query parser refactor (#683)
* Rename files to better match class name

* Don't pass setContent to QueryParser; use a generic event instead
2020-07-24 16:03:11 -04:00
toasted-nutbread
99f5655e53
Update DisplaySearch.setContent/clearContent to close popups (#682) 2020-07-24 14:54:54 -04:00
toasted-nutbread
71b97c2019
Display refactoring (#674)
* Move setupNestedPopups to Display

* Move auto-play timer and delay into Display

* Move some message handler definitions into Display

* Move default optionsContext definition
2020-07-18 23:47:02 -04:00
toasted-nutbread
27e05f8001
Reusable backend popup window (#673)
* Update _updateSearchQuery to return the promise

* Update how the clipboard search popup is opened

* Create an API function to open the search popup

* Skip animation on popup creation

* Add API function
2020-07-18 20:30:10 -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
toasted-nutbread
6f49f426b5
Generalized frame connections (#654)
* Create FrameClient and FrameEndpoint

* Use new Frame* classes for Popup=>frame connection

* Update api.sendMessageToFrame and api.broadcastTab to include the sender's frameId

* Update FrameClient to store the frame's frameId
2020-07-08 19:58:06 -04:00
toasted-nutbread
295ffa6e54
Refactor DisplayFloat=>Frontend message passing (#652)
* Change getOrCreatePopup arguments to be an object

* Add ownerFrameId to popup and DisplayFloat

* Refactor DisplayFloat host action invocation

* Use CrossFrameAPI instead of window.postMessage

* Update popup closing functionality on the search page
2020-07-08 19:50:13 -04:00
toasted-nutbread
8f48a23a45
Display class refactoring (#650)
* Organize by public/private

* Don't access super class's private members

* Make _autoPlayAudioTimer private

* Refactor constructors

* Make functions private

* Organize by public/private

* Organize window message handlers

* Make fields private

* Refactor DisplaySearch constructor

* Make functions private

* Organize by public/private
2020-07-03 15:58:29 -04:00
toasted-nutbread
e36bc8771f
Display refactor (#643)
* Remove statics

* Move orphan detection and error handling to Display

* Add clearContent function

* Add/use public get/set functions for optionsContext

* Add public getOptions

* Move interactive assignment

* Mark fields as private

* Mark functions as private

* Change stray getter into a function
2020-07-03 12:02:21 -04:00
toasted-nutbread
6ee50b3c95
Make PopupFactory.prepare non-async (#625) 2020-06-25 18:32:29 -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
713bf29377
Handle stack overflow caused by wanakana.toKana (#615) 2020-06-21 15:50:50 -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
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
a88501ff10
Text selection fixes (#511)
* select matched text in Frontend.findKanji

* blur search query input when setting content
2020-05-07 01:49:42 +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
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
ca033a87a0
Update Popup and DisplayFloat optionsContext from Frontend (#464)
* set optionsContext from Frontend

* update Popup+Display options on Frontend change

* remove popup setOptions

* only update DisplayFloat options from Frontend

* fix optionsContext usage

* fix preview frame arguments

* keep Frontend URL up to date

* cache url

* fix preview frame

* trigger modifyingProfileChange in correct places

* remove async from function not using await

* refactor optionsContext in Frontend
2020-04-26 22:33:50 +03:00
toasted-nutbread
9216d1862f
Merge pull request #463 from toasted-nutbread/explicit-entry-point
Explicit entry points
2020-04-23 18:26:34 -04:00
toasted-nutbread
c43dac19a4 Use wanakana object directly 2020-04-20 22:23:07 -04:00
toasted-nutbread
4d3d5d9ccb Rename search-frontend.js to search-main.js
Also move DisplaySearch creation into the main() function.
2020-04-19 14:29:41 -04: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
toasted-nutbread
f88d4b02e4 Use window.getSelection instead of document.getSelection 2020-04-11 15:56:08 -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
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
0112dbab33 fix searchQueryUpdate 2020-03-09 04:06:31 +02:00
toasted-nutbread
93aa275d82 Use explicit dependency injection for ClipboardMonitor 2020-03-07 10:47:30 -05:00
toasted-nutbread
7822230b7f Use events for ClipboardMonitor 2020-03-07 10:41:31 -05:00
siikamiika
967e99b7f6 ensure Backend prepare in other places 2020-03-02 04:51:45 +02:00
toasted-nutbread
52d8d658a2 Fix empty keys definitions and add Shift/Alt checks 2020-02-29 10:00:28 -05:00
toasted-nutbread
8bc1a40914 Use .bind instead of () => {} 2020-02-26 21:01:40 -05:00
toasted-nutbread
d17af2cbab Move event handler definitions 2020-02-26 19:48:53 -05:00
toasted-nutbread
13874e962b Refactor DisplaySearch.onKeyDownIgnoreKeys 2020-02-26 19:34:25 -05:00
toasted-nutbread
007789ffa0 Organize, remove unnecessary null checks 2020-02-26 19:08:35 -05:00
toasted-nutbread
0c1b250b4f Move event handler function bodies 2020-02-26 19:04:21 -05:00
toasted-nutbread
c0d91bffc4 Add no-shadow 2020-02-22 14:53:02 -05:00
siikamiika
c09a3ded1d
Merge pull request #357 from siikamiika/simplify-display-prepare
Simplify display prepare
2020-02-14 11:00:36 +02:00
siikamiika
d7e1ef01d8 use Promise.all to await dependencies 2020-02-13 16:26:45 +02:00
siikamiika
df37acd17f rename display initialize methods to prepare 2020-02-13 01:59:26 +02: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