diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2020-04-26 22:33:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-26 22:33:50 +0300 |
commit | ca033a87a0d302151b430acfdf9d480514c14aed (patch) | |
tree | ebb783c7bd371a6859c25009a57799d70ac73bac /ext/bg/js/settings/popup-preview.js | |
parent | a49e4ccc4e5c7defb30bd88535c18137acf9812c (diff) |
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
Diffstat (limited to 'ext/bg/js/settings/popup-preview.js')
-rw-r--r-- | ext/bg/js/settings/popup-preview.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/bg/js/settings/popup-preview.js b/ext/bg/js/settings/popup-preview.js index 45bf531e..fdc3dd94 100644 --- a/ext/bg/js/settings/popup-preview.js +++ b/ext/bg/js/settings/popup-preview.js @@ -16,6 +16,7 @@ */ /* global + * getOptionsContext * wanakana */ @@ -60,6 +61,23 @@ function showAppearancePreview() { frame.contentWindow.postMessage({action, params}, targetOrigin); }); + const updateOptionsContext = () => { + const action = 'updateOptionsContext'; + const params = { + optionsContext: getOptionsContext() + }; + frame.contentWindow.postMessage({action, params}, targetOrigin); + }; + yomichan.on('modifyingProfileChange', updateOptionsContext); + + frame.addEventListener('load', () => { + const action = 'prepare'; + const params = { + optionsContext: getOptionsContext() + }; + frame.contentWindow.postMessage({action, params}, targetOrigin); + }); + container.append(frame); buttonContainer.remove(); settings.css('display', ''); |