Commit Graph

492 Commits

Author SHA1 Message Date
toasted-nutbread
e12f59f87d
Force targetTabId to be null if not a number (#678) 2020-07-19 12:26:57 -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
d7f78c23b5
Script ready state change (#672)
* Update how backend/frontend ready states are awaited and signaled

* Log errors on the search page

* Update action name
2020-07-18 17:11:38 -04:00
toasted-nutbread
c6c0126394
Content script ready checks (#670)
* Move ready checkout of Display

* Add function to wait until if a tab's content script is ready
2020-07-18 14:18:10 -04:00
toasted-nutbread
a13a68990e
Port name details (#667)
* Use a stringified JSON details object for extension port names

* Fix incorrect frame ID check

* Add support for connecting to different tabs

* Add function for invoking on a different tab
2020-07-18 14:16:35 -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
toasted-nutbread
8389cd8ba2
Popup crossFrame communication (#658)
* Add support for dynamic message handlers

* Pass messages using crossFrame.invoke instead of contentWindow.postMessage

* Set up async handlers

* Simplify configure call and response
2020-07-10 22:13:59 -04:00
toasted-nutbread
f76a6ff1e3
Refactor hotkey definitions to be more generic (#655) 2020-07-08 20:02:20 -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
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
a07a8dfff6
Extension unload detection (#647)
* Update how extension unload is detected

* Remove event handlers and use yomichan.isExtensionUnloaded instead

* Update terminology
2020-07-03 12:20:22 -04:00
toasted-nutbread
ce634325ce
Add up arrow icon (#648) 2020-07-03 12:02:59 -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
d776125ead
Refactor timer privates (#639)
* Make Timer.current public

* Make _indentString non-static
2020-07-03 11:58:12 -04:00
toasted-nutbread
897d85d1ac
Util refactor and fix (#638)
* Remove unused functions

* Fix clone function not being visible on the window object
2020-07-03 11:57:15 -04:00
toasted-nutbread
af4dc49074
Fix chrome.runtime.manifest failing when extension is reloaded (#646) 2020-07-01 21:06:25 -04:00
toasted-nutbread
f2345b7d1c
Use deferPromise (#630)
* Use deferPromise

* Move definition

* Implement promiseTimeout using deferPromise
2020-06-28 14:39:43 -04:00
toasted-nutbread
7b5dd5c310
Update browser compatibility and Edge detection (#629) 2020-06-28 12:40:02 -04:00
toasted-nutbread
cdf191336a
Clone function (#624)
* Add clone function

* Replace utilIsolate with clone

* Replace JsonSchema.isolate with clone function

* Include core.js for tests which use json-schema.js

* Update visisted set
2020-06-28 12:38:34 -04:00
toasted-nutbread
5bf805755a
Yomichan object separation (#627)
* Move "yomichan" object setup to a separate file

* Update script imports

* Align message handlers

* Rename Yomichan.prepare to Yomichan.ready

* Add new prepare function

* Improve isExtensionUrl
2020-06-28 11:26:43 -04:00
toasted-nutbread
51981f0c4e
Add deferPromise function (#626) 2020-06-28 11:23:51 -04:00
toasted-nutbread
22d70c9e22
Add lock icon (#628) 2020-06-26 17:22:29 -04:00
toasted-nutbread
3e68af8666
Shadow DOM container for popup iframes (#623)
* Add support for injecting stylesheets into a custom parent node

* Add api.getStylesheetContent

* Add support for injecting a CSS file's content

* Add usePopupShadowDom option

* Use a per-parentNode cache

* Add support for using a shadow DOM wrapper around popup iframes

* Ignore the popup container instead of the frame
2020-06-24 21:46:13 -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
9e28db6ef7
Safely handle volume values that are out of range (#617) 2020-06-21 15:51:36 -04:00
toasted-nutbread
8a7ff6a18c
Replace XMLHttpRequest (#562)
* Replace XMLHttpRequest with fetch

* Implement fetch placeholder for tests
2020-06-13 10:23:04 -04:00
toasted-nutbread
a84f188b73
Handle cases where platform info is not available (#597)
* Handle cases where platform info is not available

* Safely return the correct os property
2020-06-10 20:58:46 -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
siikamiika
b614aca3dd
fix css class name (#591)
Broken in 90af55d4c84f545635f238178b30748a0e8093ee
2020-06-07 00:08:46 +03:00
siikamiika
0384e2afef
scale background icon when page is zoomed (#592) 2020-06-07 00:08:20 +03:00
toasted-nutbread
2c58b1c109
Limit action port message size (#587)
* Add onDisconnect handler

* Update how error is posted

* Update action ports to send long messages in fragments

* Remove ack timer

* Move message destructuring into try block
2020-05-31 18:17:12 -04:00
toasted-nutbread
976a200ffc
Backup update (#582)
* Add function to assign all settings

* Update how settings backups are restored

* Remove page reload

* Update profile index after importing
2020-05-30 16:23:56 -04:00
toasted-nutbread
37f0396f1c
DOM binder fixes (#564)
* Fix incorrect updateValue function

* Add source
2020-05-29 19:44:53 -04:00
toasted-nutbread
6dd6af05e1
Update background global object usage (#556)
* Omit global window object for scripts used on the background page

* Validate document exists before using

* Remove dom.js from background.html
2020-05-24 14:01:21 -04:00
toasted-nutbread
66e1185686
Settings binder (#542)
* Fix _modifySetting being async

* Return values for modifySettings's set and splice actions

* Add apiGetSettings

* Create a class which can accumulate tasks to run in bulk

* Create a class which binds input elements to customizable sources

* Create class which binds input elements to settings

* Add support for value transforms

* Remove redundant ObjectPropertyAccessor.getPathArray

* Fix not using correct types for input.min/max/step

* Fix wrong condition

* Use api object
2020-05-24 13:50:34 -04:00
toasted-nutbread
c800444a0d
Ensure the return value of promiseTimeout always has .resolve and .reject (#550) 2020-05-24 13:39:50 -04:00
toasted-nutbread
a595a0a481
Add icons (#540)
* Add icons

* Update icons
2020-05-24 13:37:49 -04:00
toasted-nutbread
4d2e5b93f4
Style adjustments (#537)
* Remove newlines for term-definition-item-template

* Update how action button icons are styled

* Fix spacing

* Group text colors together

* Correct image styles

* Fix missing </span>
2020-05-24 13:37:23 -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
83a577fa56
Add missing spreads (#552) 2020-05-23 14:18:02 -04:00
toasted-nutbread
694120b8a5
Cross frame communication (#531)
* Set up new cross-frame port connector

* Create classes for cross-frame API invocation with replies

* Remove event listeners on disconnect
2020-05-23 13:34:55 -04:00
toasted-nutbread
9a657214ad
Add support for additional types of event listeners (#522)
* Add support for additional types of event listeners

* Fixes
2020-05-23 13:19:31 -04:00
siikamiika
39df44eca4
Fix "tags" template (#539)
* fix tag templates for merge and group modes

* update version upgrade

* adjust upgrade replacement order
2020-05-22 20:03:34 -04:00
toasted-nutbread
dd673f0b26
Dynamic loader load style (#521)
* Remove unnecessary load of /fg/css/client.css

* Replace dynamicLoader.loadStyles with dynamicLoader.loadStyle

* Replace Popup._injectStylesheet with dynamicLoader.loadStyle

* Remove unused global
2020-05-19 20:33:06 -04:00
toasted-nutbread
9742d5662b
Use CSS variables for themes (#528)
* Update formatting

* Merge default tag color with category-less tags

* Use CSS variables for colors

* Add dark theme colors

* Move color variables into display.css

* Remove old stylesheets

* Update headings

* Bump minimum Firefox version to support CSS var()

* Revert popular kanji text color
2020-05-10 14:07:25 -04:00
toasted-nutbread
9900291b07
Fix not awaiting the AudioSystem.arrayBufferDigest promise (#524) 2020-05-09 12:28:48 -04:00
siikamiika
d6a3825a38
Modifier key platform names (#519)
* wip

* add environment class

* use Environment class

* use Environment for scanning modifier options

* remove Environment in favor of API

* await promise

* use modifier symbols on macOS

* fix key separator issues

* if else to switch

* simplify variable names
2020-05-09 18:36:00 +03:00