Commit Graph

2403 Commits

Author SHA1 Message Date
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
96932119f8
Remove window. from visualViewport, use local variable instead (#621) 2020-06-22 19:27:40 -04:00
toasted-nutbread
65c41975a6
Secure popup frame url changes (#622)
* Throw error if options is not ready

* Remove id

* Change unsecurePopupFrameUrl to useSecurePopupFrameUrl
2020-06-22 19:26:59 -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
244ab31bb2
Generic database (#600)
* Update test

* Rename db to _db

* Create GenericDatabase class

* Catch prepare error

* Allow database to be purged even if it was not open

* Remove unused functions

* Change static functions to non-static

* Delete and count using the media object store

* Update tests
2020-06-21 16:12:56 -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
4ebee3e17c
Context popup update (#594)
* Add link to the help button

* Update context.html to not use bootstrap

Styles moved into a separate file
Update icons

* Update terminology to correspond to new icons
2020-06-21 15:57:18 -04:00
toasted-nutbread
0c69e54fde
Optimize anki note field generation (#611) 2020-06-21 15:54:34 -04:00
toasted-nutbread
3db7b3a925
Add option to use the unsecure frame URL (#618) 2020-06-21 15:52:43 -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
713bf29377
Handle stack overflow caused by wanakana.toKana (#615) 2020-06-21 15:50:50 -04:00
toasted-nutbread
6562d0c1e5
Template renderer class (#574)
* Convert handlebars.js to a class

* Move/rename function

* Update helper registration

* Rename helper functions

* Limit cache size

* Make render() async

* Rename and move
2020-06-15 20:11:54 -04:00
toasted-nutbread
b4a617cac3
Ignore getZoom errors (#604) 2020-06-14 15:14:47 -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
8d1a276a83
Remove debug log (#603) 2020-06-13 10:42:59 -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
5cba421201
Update the badge icon if the backend experiences an error (#602) 2020-06-13 10:20:12 -04:00
toasted-nutbread
8bc15e60b5
Detect language tags starting with "ja_" (#596) 2020-06-13 10:18:44 -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
839e306cac
Immediate backend event handlers (#555)
* Add function to await until prepare is completed

* Create BackendEventHandler to synchronously set up event handling
2020-06-07 21:50:14 -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
cfd3a1ec3a
Update AudioController to not use mutable options references (#585) 2020-05-30 21:54:38 -04:00
toasted-nutbread
db209c9116
Generic settings controller merge (#584)
* Update how optionsContext is assigned to targets

* Add getSettings and modifySettings

* Merge DOMSettingsBinder into GenericSettingController

* Remove old DOMSettingsBinder
2020-05-30 21:53:36 -04:00
toasted-nutbread
ce7f9dd09a
Update how assignment of general.enableClipboardPopups works (#583) 2020-05-30 16:24:51 -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
c8810bc929
Update AnkiController (#581)
* Update how fields are populated

* Update how fields are modified after a model change

* Update how _onFieldsChanged assigns fields

* Update how spinner is hidden

* Remove jQuery usage

* Use non-jQuery events
2020-05-30 16:22:51 -04:00
toasted-nutbread
ad8df26b6b
Update AnkiTemplatesController (#580)
* Use this._defaultFieldTemplates

* Don't use mutable options

* Remove some use of jQuery
2020-05-30 16:22:05 -04:00
toasted-nutbread
395a0f4096
Update GenericSettingController to use DOMSettingsBinder (#578) 2020-05-30 16:20:31 -04:00
toasted-nutbread
f228078613
SettingsController API update (#579)
* Include optionsContext as part of optionsChanged event

* Add get/modify functions
2020-05-30 11:24:34 -04:00
toasted-nutbread
789da0206b
Organize settings/main.js (#577) 2020-05-30 09:50:33 -04:00
toasted-nutbread
63a3e56367
Use SettingsController (#576)
* Use settingsController internally in settings/main.js

* Replace modifyingProfileChange with SettingsController.optionsContextChanged

* Update ClipboardPopupsController to use SettingsController

* Store reference to checkbox

* Use this._settingsController for everything

* Change where current profile is initially assigned from

* Remove some unnecessary async calls

* Move setup calls

* Update AnkiTemplatesController to use SettingsController

* Cache default field templates

* Update AnkiController to use SettingsController

* Update AudioController to use SettingsController

* Update SettingsBackup to use SettingsController

* Update DictionaryController to use SettingsController

* Update GenericSettingController to use SettingsController

* Update ProfileController to use SettingsController

* Remove unused

* Remove unused

* Replace some uses of api.options* functions

* Fix missing awaits

* Fix invalid function
2020-05-30 09:33:13 -04:00
toasted-nutbread
1a5a37c9e4
Fix frontend being null if messages are received early (#575) 2020-05-30 09:31:46 -04:00
toasted-nutbread
18f376358c
Generic settings controller + clipboard popups controller (#573)
* Create GenericSettingController

* Create ClipboardPopupsController
2020-05-29 20:33:40 -04:00
toasted-nutbread
df040b104a
Popup preview frame refactor (#572)
* Use private variables

* Use private methods

* Update overrides

* Make prepare called in the entry point function

* Change format of handlers

* Change where _apiOptionsGetOld is assigned

* Rename class
2020-05-29 20:29:19 -04:00
toasted-nutbread
9624566d2a
Convert popup-preview.js to a class (#571)
* Convert popup-preview.js to a class

* Don't invoke 'prepare'
2020-05-29 20:28:12 -04:00
toasted-nutbread
418e8a57bf
Convert dictionaries.js and storage.js to classes (#570)
* Convert dictionaries.js to a class

* Remove storage spinner

* Convert storage.js to a class

* Move dataset assignments into main.js
2020-05-29 20:25:22 -04:00
toasted-nutbread
c62f980f37
Audio controller (#569)
* Convert audio.js into a class

* Move audio-ui.js classes into audio.js

* Rename fields

* Merge classes

* Remove audio-ui.js
2020-05-29 19:56:38 -04:00
toasted-nutbread
5f9889fd26
Anki settings controllers (#567)
* Convert anki-templates.js to a class

* Convert anki.js to a class
2020-05-29 19:52:51 -04:00
toasted-nutbread
fde0072118
Change profile.js into a class (#566)
* Update how settings profile is stored and accessed

* Convert profiles.js into a class

* Rename members of ProfileController
2020-05-29 19:47:18 -04:00
toasted-nutbread
8537c8f386
Create class to abstract access, mutation, and events for settings (#565) 2020-05-29 19:45:54 -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
9d40955fc8
Update legal.html to include full licenses (#563) 2020-05-24 22:10:50 -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
3c4c82dcfc
Ensure single popup factory (#554)
* Add createPopupFactory

* Ensure only a single PopupFactory is generated
2020-05-24 14:00:32 -04:00
toasted-nutbread
13f57cccba
Settings backup refactor (#551)
* Update backup.js to be a class

* Move utilReadFileArrayBuffer
2020-05-24 13:56:46 -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
3089bb7908
Settings refactor (#541)
* Remove debug info

* Trigger onOptionsUpdated instead of formWrite when profile changes

* Update how Anki field changes are observed

* Update how general.enableClipboardPopups setting is changed

* Change where ankiTemplatesUpdateValue occurs

* Change where onDictionaryOptionsChanged occurs

* Remove unused global declarations

* Remove stray data attribute
2020-05-24 13:38:48 -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
d0dcff765f Version bump to 20.5.22.0 2020-05-22 17:41:33 -07: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
dd6c3015c4
Use both shadowRoot and openOrClosedShadowRoot (#534) 2020-05-10 14:10:02 -04:00
toasted-nutbread
c38cd70e91
Load frame content using contentDocument.location.href instead of src attribute (#529) 2020-05-10 14:08:18 -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
5752b23a8e
Text source refactor (#527)
* Update TextSourceElement API to have parity with TextSourceRange

* Make fields private

* Update equality check

* Fix "this.element" being used instead of just "element"
2020-05-10 14:06:25 -04:00
toasted-nutbread
6eafdac362
Fix setStartOffset not appending (#526) 2020-05-09 21:09:23 -04:00
toasted-nutbread
bdbe680f5c
Omit the sound tag if it's empty (#525) 2020-05-09 12:29:41 -04:00
toasted-nutbread
9900291b07
Fix not awaiting the AudioSystem.arrayBufferDigest promise (#524) 2020-05-09 12:28:48 -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
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
toasted-nutbread
48cf646973
Popup refactor (#518)
* Add default

* Convert function to non-static

* Remove static for private functions

* Replace .call

* Move functions with side effects into a synchronous prepare function

* Rename variables with "container" to "frame" in _initializeFrame

* Rename variables with "container" to "frame"

* Rename getContainer to getFrame

* Rename getContainerRect to getFrameRect

* Organize and simplify

* Fix incorrect change of "popup" => "this"

* Move initial _updateVisibility into prepare()
2020-05-08 19:10:06 -04:00
toasted-nutbread
3949db26d7
Text scanner refactor (#517)
* Fix return type

* Pass search function as a constructor argument

* Pass constructor as a details object

For consistency with other complex constructors and improved semantics.

* Convert _ignorePoints to a single optional function

* Organize functions

* Rename ignorePoints to ignorePoint
2020-05-08 19:05:50 -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
b972f8cbf6
Text scanner refactor (#515)
* Mark functions as private

* Mark fields as private

* Add getter/setters for publicly used fields

* Replace public static functions with private non-static functions

* Update comment
2020-05-07 19:45:08 -04:00
toasted-nutbread
33bd9682ea
Query parser refactor (#514)
* Make functions private

* Make fields private

* Organize
2020-05-07 19:41:27 -04:00
toasted-nutbread
edb86d9ec3
Organize frontend functions (#513) 2020-05-07 19:38:09 -04:00
toasted-nutbread
caca9869c4
Add contentScript parameter to backend message handlers (#512)
* Add contentScript parameter to message handlers

* Remove _validatePrivilegedMessageSender calls from handler functions

* Reformat handlers
2020-05-07 19:37:25 -04:00
toasted-nutbread
f361139d74
Japanese util refactor (#510)
* Convert mixed japanese.js to utility class

* Copy functions from bg/js/japanese.js into mixed/js/japanese.js

* Remove bg/js/japanese.js

* Make wanakana dependency optional

* Update tests
2020-05-06 19:37:36 -04:00
toasted-nutbread
4eeb879fb8
Remove search query parser inheritance (#509)
* Remove getMouseEventListeners override

* Use this._options instead of this.options

* Make QueryParser use composition instead of inheritance for TextScanner

* Remove repeat call to document.querySelector('#query-parser-content')
2020-05-06 19:36:42 -04:00
toasted-nutbread
38d6f58fac
Frontend refactor (#508)
* Use this.popup instead of this.frontend.popup

* Rename Frontend.popup to _popup

* Make Frontend functions private

* Clean up Frontend constructor
2020-05-06 19:35:36 -04:00
toasted-nutbread
d6ae322961
Text scanning update (#507)
* Fix unity test missing a parameter

* Update docSentenceExtract to not rescan content
2020-05-06 19:34:32 -04:00
toasted-nutbread
f7df6254d6
Dom text scanner fixes (#505)
* Fix test case

* Add test-dom-text-scanner

* Ensure that DOMTextScanner._node never becomes null

* Add remainder
2020-05-06 19:33:17 -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
toasted-nutbread
021ccb5ac3
Move util database modification functions (#499)
* Update onProgress callback to handle multiple arguments

* Add apiImportDictionaryArchive

* Add apiDeleteDictionary

* Make onProgress the last argument for consistency

* Remove deprecated util functions

* Fix issue with missing progress args

* Remove function calls which modify the database from Translator

* Update tests

* Fix errors not being serialized correctly in _createActionListenerPort
2020-05-06 19:28:26 -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
ac2f743b76
Remove invalid file name characters from Anki media files (#496)
* Replace invalid file name characters

* Replace "filename" with "fileName"
2020-05-06 19:25:56 -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
253dcf8b38
Fix modifier key condition data (#506)
* save transformed data for modifier key conditions

* validate transformed input

* fix regression

* undo rename

* refactor transformInput handling

* don't overwrite value with null
2020-05-06 19:44:56 +03:00
siikamiika
a1f8f0d1de
support meta as scanning modifier (#502) 2020-05-05 00:14:21 +03:00
siikamiika
7d7ff165ce
Extract textSource text inside TextScanner (#500)
* extract text inside TextScanner

* clone textSource before text extraction
2020-05-05 00:13:43 +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
acfdaa4f48
Fix incorrect static call (#498) 2020-05-02 17:24:05 -04:00
toasted-nutbread
d4ae9aa501
DOMTextScanner (#458)
* Create new class for scanning text in a document

* Update test styles

* Add tests
2020-05-02 13:05:43 -04:00
toasted-nutbread
d581bffa15
Style fixes (#494)
* Place multi-line expression parentheses on the correct line

* Add function-paren-newline eslint rule

* Add some additional eslint rules
2020-05-02 13:04:17 -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
51032d1eca
Catch WrongDocumentError thrown by compareBoundaryPoints (#491)
* Catch WrongDocumentError thrown by compareBoundaryPoints

* Filter error based on name
2020-05-02 12:59:59 -04:00
toasted-nutbread
efa7a5ecc3
Remove and unload the popup frame if an unexpected load occurs (#490)
* Remove and unload the popup frame if an unexpected load occurs

* Remove unused fields

* Only update _injectPromiseComplete if the promise is the most recent one

* Remove redundant this._injectPromise !== null check
2020-05-02 12:59:13 -04:00
toasted-nutbread
8a368aaddc
Don't parent the popup frame to elements which cause unload (#488) 2020-05-02 12:58:24 -04:00
toasted-nutbread
401fe9f8d0
Object property accessor API update (#485)
* Simplify function names

* Add delete and swap functions

* Remove custom setter

Not currently part of the expected use cases.

* Add documentation

* Update tests

* Add delete test functions

* Update tests to use fresh objects

* Add swap test functions

* Add empty tests

* Disable delete on arrays
2020-05-02 12:57:42 -04:00
toasted-nutbread
5a61c311ad
Api invoke with progress (#483)
* Create an internal API function to open a port

* Create system for running actions over a special port

* Don't assign in expression
2020-05-02 12:57:13 -04:00
toasted-nutbread
6c341a13d8
Refactor frontend API classes (#482)
* Mark functions as private

* Remove constructor side effects

* Use safer handler invocation

* Mark functions as private

* Mark fields as private

* Update BackendApiForwarder public API
2020-05-02 12:50:44 -04:00
toasted-nutbread
cae6b657ab
Anki audio download (#477)
* Update how audio is added to Anki cards

* Upgrade Anki templates

* Update comments
2020-05-02 12:50:16 -04:00
toasted-nutbread
08ada6844a
Remove Frontend inheritance (#486)
* Make Frontend use composition instead of inheritance for TextScanner

* Use push instead of concat

* Update setOptions and setEnabled APIs

* Update how onWindowMessage event listener is added/removed

* Rename options to _options

* Use bind instead of arrow function

* Fix selection being cleared due to settings changes
2020-05-02 12:47:15 -04:00
Allan Wirth
ce861ce079
Add helpful link for markers in settings.html (#489) 2020-05-01 16:59:19 -04:00
toasted-nutbread
0956634d61
Add duplicateScope: 'deck' option (#476)
* Add duplicateScope: 'deck' option

* Add option to control duplicate scope

* Use duplicateScope for findNoteIds

* Update location of quotes
2020-04-27 18:10:59 -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
887d769786
Use dynamicLoader for main (#481)
* Update style of search-main and float-main to have better parity

* Use dynamicLoader to inject scripts and CSS
2020-04-26 16:56:34 -04:00
toasted-nutbread
4e0fc76fe1
Add Yomichan icon SVG (#478)
* Create Yomichan icon SVG and 32x32 PNG

* Update icons

* Add 32x32 icon definition to HTML pages
2020-04-26 16:56:14 -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
a49e4ccc4e
Merge pull request #472 from toasted-nutbread/fix-pitch-accent-high-calculation
Fix high pitch calculation
2020-04-23 18:27:11 -04:00
toasted-nutbread
6b0f1f268b
Merge pull request #467 from toasted-nutbread/dynamic-loader
Create dynamic script/CSS loader utility
2020-04-23 18:26:48 -04: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
siikamiika
6cd86e203a fix custom anki templates 2020-04-23 19:58:31 +03:00
toasted-nutbread
d8276a9d5d Use IIFE for entry points 2020-04-22 21:42:20 -04:00
toasted-nutbread
2f931e5585 Fix high pitch calculation 2020-04-22 21:04:18 -04:00
toasted-nutbread
749b747728 Remove sentinel script node after load 2020-04-22 17:48:42 -04:00
toasted-nutbread
d05a5f3c46 Create dynamic script/CSS loader utility 2020-04-21 21:16:26 -04:00
toasted-nutbread
d106c638ed Move popup-nested content into float-main 2020-04-21 18:38:55 -04:00
toasted-nutbread
c43dac19a4 Use wanakana object directly 2020-04-20 22:23:07 -04:00
toasted-nutbread
9ca906ef90 Create float-main.js 2020-04-19 14:29:43 -04:00
toasted-nutbread
7c578f7582 Create popup-preview-frame-main.js 2020-04-19 14:29:43 -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
3edaf319da Rename context.js to context-main.js 2020-04-19 14:27:15 -04:00
toasted-nutbread
3c8eb9eee0 Create background-main.js 2020-04-19 14:26:44 -04:00
toasted-nutbread
6c93d1984f Change frontend-initialize.js to content-script-main.js 2020-04-19 14:26:20 -04:00
toasted-nutbread
ba68616d80 Change some more variables using 'source' instead of 'content' 2020-04-19 10:57:23 -04:00
toasted-nutbread
a7e7d546c7 Add documentation 2020-04-19 10:24:59 -04:00
toasted-nutbread
0e80c0d5d0 Rename loadImage to loadImageBase64 for clarity 2020-04-19 10:24:43 -04:00
toasted-nutbread
16893b52b1 Make getFileNameExtension properly handle directory separators 2020-04-19 10:18:31 -04:00
toasted-nutbread
7faaf4e457 Use 'content' instead of 'source' to contain media file data 2020-04-19 10:16:59 -04:00
toasted-nutbread
07e5e5c15b Show small image preview on [Image] link hover/focus 2020-04-18 21:33:14 -04:00
toasted-nutbread
c75a0d4e70 Fix space being inside the <a> and thus being underlined 2020-04-18 21:33:14 -04:00
toasted-nutbread
ac603d54a3 Add support for displaying images 2020-04-18 21:32:35 -04:00
toasted-nutbread
fd6ea0e404 Add API for getting media data 2020-04-18 21:32:35 -04:00
toasted-nutbread
8106f4744b Add support for importing and storing media files 2020-04-18 21:31:09 -04:00
toasted-nutbread
51d756eefc Fix _prepareError check 2020-04-18 21:15:15 -04:00
toasted-nutbread
4638985b16 Remove unused global 2020-04-18 21:12:54 -04:00
toasted-nutbread
66ef730119 Update style, use isObject 2020-04-18 21:12:54 -04:00
toasted-nutbread
dee7d924a8 Show error status for prepare() errors 2020-04-18 21:12:54 -04:00
toasted-nutbread
5c5c70326d Add a delay before showing the loading state
Intended to prevent flickering when startup is quick
2020-04-18 21:12:54 -04:00
toasted-nutbread
c9704b5c5e Update when/how badge state is changed 2020-04-18 21:12:54 -04:00
toasted-nutbread
6498556ec7 Update isPrepared to be consistent with DisplaySearch's isPrepared 2020-04-18 21:11:15 -04:00
toasted-nutbread
03d77cc3a6
Merge pull request #442 from toasted-nutbread/audio-system-refactoring
Audio system refactoring
2020-04-18 21:10:48 -04:00
siikamiika
d66ca93ce4 cache invalidation 2020-04-18 23:28:00 +03:00
siikamiika
a81c33b60a simplify element source lazy load 2020-04-18 23:28:00 +03:00
siikamiika
691b739849 cache closed shadow dom content windows 2020-04-18 23:28:00 +03:00
siikamiika
66354f1f9e lazy load element sources 2020-04-18 23:28:00 +03:00
siikamiika
bb3ad78e37 optimize source frame finding 2020-04-18 23:28:00 +03:00
siikamiika
350a113996 use getFullscreenElement to check fullscreen 2020-04-18 23:28:00 +03:00
siikamiika
b786e2da19 move open shadow root iframe finder to a function 2020-04-18 23:28:00 +03:00