Commit Graph

62 Commits

Author SHA1 Message Date
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
b253cdc92e
Fix extension unload cases (#712)
* Add _invokeSafe function to silently ignore extension unload errors

* Remove "Api" from function names

* Add invokeSafe to Popup

* Don't redundantly set content type to 'unloaded'
2020-08-02 21:51:51 -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
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
562cfd7470
Make PopupProxy._frameOffsetExpireTimeout non-static (#640) 2020-07-03 11:58:52 -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
b612bd8b8d
PopupProxy refactor (#609)
* Remove setDisabled member; replace with an event

* Pass frameOffsetForwarder directly to PopupProxy

* Replace .start with .prepare

* Make onMessage private

* Make message safer and handle unexpected inputs
2020-06-14 14:06:52 -04:00
toasted-nutbread
9767b76553
Use cross frame API (#553)
* Use new CrossFrameAPI for popup proxy communication

* Remove use of old cross-frame communication classes

* Remove use of old cross-frame communication files

* Make the crossFrame object a member of the api object
2020-06-07 21:40:11 -04:00
toasted-nutbread
69c783f861
Frontend/popup proxy message refactoring (#520)
* Use direct message handler functions

* Remove unused targetPopupId

* Make target a member of FrontendApiSender

* Rename frameId to parentFrameId for clarity

* Remove _parentFrameId

* Rename _parentId to _parentPopupId for clarity
2020-05-09 12:27:56 -04:00
toasted-nutbread
b936c3e4b1
Popup proxy host refactor (#516)
* Rename PopupProxyHost to PopupFactory

* Update FrontendApiReceiver to support non-async handlers

* Make some functions non-async

* Make setCustomCss non-async

* Make setContentScale non-async

* Remove static

* Rename variables

* Pass frameId into PopupFactory's constructor

* Change FrontendApiReceiver source from popup-proxy-host to popup-factor

* Rename _invokeHostApi to _invoke

* Rename PopupProxy.getHostUrl to getUrl
2020-05-08 19:04:53 -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
siikamiika
85706c421b show popup inside iframe for closed shadow dom 2020-04-18 23:28:00 +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
aea7c590d1 refactor _updateFrameOffset 2020-04-05 20:03:45 +03:00
siikamiika
abd056e563 reduce code duplication 2020-04-05 20:03:45 +03:00
siikamiika
0d76cef434 give a name to a timeout 2020-04-05 19:57:37 +03:00
siikamiika
e4fc53480f move broadcastRootPopupInformation to Frontend 2020-04-05 19:57:37 +03:00
siikamiika
559033f0a6 default to [0, 0] when sourceFrame is not found 2020-04-05 19:57:37 +03:00
siikamiika
7928c5d713 error handling 2020-04-05 19:57:37 +03:00
siikamiika
9f9ea1d5fb throttle frame offset getting 2020-04-05 19:57:37 +03:00
siikamiika
9fe1e38afb refactor 2020-04-05 19:57:37 +03:00
siikamiika
d20ece9f07 move frame offset forwarding code to a class 2020-04-05 19:57:37 +03:00
siikamiika
09151a1a86 simplify popup proxy prepare 2020-04-05 19:57:37 +03:00
siikamiika
b996d0b1e0 fix and simplify 2020-04-05 19:57:37 +03:00
siikamiika
4814db8df1 adjust iframe popup position to root page 2020-04-05 19:57:37 +03: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
dcd243c9e9 Update how popups are created 2020-02-16 18:59:08 -05:00
toasted-nutbread
b5d32c73e6 Simplify process to wait for iframe prepare completion 2020-02-16 12:23:20 -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
810a7e7d92 use sendMessage to notify about initialization 2020-02-14 02:33:54 +02:00
toasted-nutbread
e2ac478cb7 Define more globals 2020-02-11 22:22:16 -05:00
toasted-nutbread
65dfb855fb Fix undefined id 2020-02-11 22:21:55 -05:00
toasted-nutbread
e740965d4f Scale popup based on current page zoom factor 2020-01-22 20:38:21 -05: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
68a0293867 Make PopupProxy functions async enabled status match Popup 2019-12-16 19:54:41 -05:00
toasted-nutbread
0fb2357ec7 isVisibleAsync => isVisible 2019-12-16 19:54:41 -05:00
toasted-nutbread
72ab6f1f45 Remove unused child getter 2019-12-16 19:54:41 -05:00
toasted-nutbread
30e13354b3 Add Popup.isProxy 2019-12-16 19:54:41 -05:00
toasted-nutbread
8efbf9bd0d Flag members as private 2019-12-16 19:54:41 -05:00
toasted-nutbread
bf02eb2ea1 Mark PopupProxy internal functions as private 2019-12-16 19:54:41 -05:00
toasted-nutbread
8f918c63dc Reposition popup on window resize rather than clear the search
Fixes #107
2019-10-17 18:40:43 -04:00
toasted-nutbread
598cd32946 Update *show* APIs to unified showContent and setContent 2019-10-17 18:40:43 -04:00
toasted-nutbread
883226b045 Update how custom CSS is applied 2019-10-12 19:00:24 -04:00
toasted-nutbread
6da7683552 Don't pass options around for calls to termsShow, kanjiShow, etc. 2019-10-12 15:31:29 -04:00
toasted-nutbread
8a1637f6b3 Remove .show popup proxy API since it's not used 2019-10-12 15:31:29 -04:00
toasted-nutbread
194615ef21 Make popups store options 2019-10-12 15:31:29 -04:00