Commit Graph

60 Commits

Author SHA1 Message Date
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
501281e887
Popup init update (#497)
* Add API function to send a message to a specific frameId in a tab

* Update _windowMessageHandlers to support additional info per handler

* Remove message token

* Add new authorization check

* Set up new initialization handler

* Update initialization

* Remove message token

* Replace 'prepare' with 'configure'

* Create new prepare function

* Change configure guard

* Log errors in onMessage

* Improve popup initialize function

* Clear secret/token in _resetFrame

* Remove backend message token

* Clear src and srcdoc attributes before loading

* Don't treat about:blank unloads as load events
2020-05-06 19:27:21 -04:00
toasted-nutbread
c4ea9321dc
Validate document nodes before use (#493)
* Validate document.body before use in loadScripts

This also fixes an issue where reject wasn't being passed to loadScriptSentinel.

* Validate document nodes before use in _getSiteColor

* Validate document.body before use in _getViewport

* Validate document.body before use in setContentScale

* Validate document.body before use in docImposterCreate
2020-05-02 13:00:46 -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
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
9ca906ef90 Create float-main.js 2020-04-19 14:29:43 -04:00
toasted-nutbread
a864cf094f
Merge pull request #437 from toasted-nutbread/backend-api-handler-changes
Backend api handler changes
2020-04-11 11:32:52 -04:00
toasted-nutbread
a296c758b9 apiBroadcast => apiBroadcastTab 2020-04-10 20:00:18 -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
toasted-nutbread
a2b66dc6cc Rename apiForward to apiBroadcast 2020-04-07 19:51:39 -04:00
toasted-nutbread
696897f6fa Add support for getting the document title 2020-04-06 18:55:36 -04: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
314c567a47 fix hotkeys in popup 2020-03-01 19:02:43 +02:00
toasted-nutbread
8bc1a40914 Use .bind instead of () => {} 2020-02-26 21:01:40 -05:00
toasted-nutbread
03ba1b633e Move event handler definitions 2020-02-26 20:03:21 -05:00
toasted-nutbread
0f46e3a093 Use a token to ensure that messages are coming from Yomichan 2020-02-17 11:02:21 -05:00
toasted-nutbread
6df5220e02 Prevent multiple prepare calls 2020-02-16 12:23:40 -05:00
toasted-nutbread
b5d32c73e6 Simplify process to wait for iframe prepare completion 2020-02-16 12:23:20 -05:00
toasted-nutbread
89cb98e4d1 Add global apiForward 2020-02-14 21:50:17 -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
siikamiika
c0225f1f84 notify popup about initialization 2020-02-13 13:18:54 +02:00
siikamiika
df37acd17f rename display initialize methods to prepare 2020-02-13 01:59:26 +02:00
toasted-nutbread
e2ac478cb7 Define more globals 2020-02-11 22:22:16 -05:00
toasted-nutbread
e740965d4f Scale popup based on current page zoom factor 2020-01-22 20:38:21 -05:00
toasted-nutbread
dbbcfa5739 Only use Display.setContent 2020-01-16 22:39:26 -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
b2cc694d95 Replace window.yomichan_display with DisplayFloat.instance 2019-12-20 23:20:42 -05:00
toasted-nutbread
2519f99f54 Update how orphan state is observed 2019-12-20 13:44:33 -05:00
toasted-nutbread
b7144ed879 Update display float key handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
5588643988 Update float message handlers 2019-12-13 23:11:56 -05:00
toasted-nutbread
0aed27b66d Replace hasOwnProperty with simplified hasOwn function 2019-11-26 22:06:27 -05: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
537d2ef532 Remove Display.dependencies 2019-10-12 15:31:29 -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
3e249e19ac Update Display initialization process 2019-10-12 15:31:29 -04:00
toasted-nutbread
cc72514ce6 Frontend updates 2019-10-11 23:24:51 -04:00
toasted-nutbread
c5d6b9452d Create utility function for logging errors 2019-10-08 22:38:05 -04:00
toasted-nutbread
fa7ee468c0 Simplify float initialization 2019-10-02 21:12:24 -04:00
toasted-nutbread
bf382652a7 Use static object for float message handlers 2019-10-02 20:46:35 -04:00
toasted-nutbread
a628610cbd Use KeyboardEvent.key for onKeyDown handlers 2019-10-02 19:49:52 -04:00
toasted-nutbread
95a7fd81f5 Use raw element references for container and spinner 2019-09-27 21:41:00 -04:00
toasted-nutbread
476a5e873a Remove jQuery usage from float.js 2019-09-27 21:16:10 -04:00
toasted-nutbread
dcfe722ba6 Add support for using optionsContext to select which profile to use 2019-09-18 19:14:04 -04:00
toasted-nutbread
bc8793eb56 Add a context object for all calls to fetch options 2019-09-10 20:09:33 -04:00
toasted-nutbread
3491affcf1 Update nested initialization parameters passed via message rather than using the URL query string 2019-09-02 19:33:28 -04:00