diff options
| author | siikamiika <siikamiika@users.noreply.github.com> | 2020-03-21 22:29:07 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-21 22:29:07 +0200 | 
| commit | 08d38d8db2c97ff9f016a6de640f645b609088d1 (patch) | |
| tree | 9060deb6f870e472c601b6cec050a2f60f62abca /ext/fg/js/frontend.js | |
| parent | 647769f2baae338f201690f21c4bf8983bcb10b0 (diff) | |
| parent | b616bac66ed0735c1e7ebbaf1ceba20b081f1a6f (diff) | |
Merge pull request #411 from siikamiika/apply-all-options-profile-change
apply all options on profile change
Diffstat (limited to 'ext/fg/js/frontend.js')
| -rw-r--r-- | ext/fg/js/frontend.js | 18 | 
1 files changed, 16 insertions, 2 deletions
| diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 768b9326..d6c5eac6 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -26,10 +26,9 @@   */  class Frontend extends TextScanner { -    constructor(popup, ignoreNodes) { +    constructor(popup) {          super(              window, -            ignoreNodes,              popup.isProxy() ? [] : [popup.getContainer()],              [(x, y) => this.popup.containsPoint(x, y)]          ); @@ -95,6 +94,9 @@ class Frontend extends TextScanner {      }      onRuntimeMessage({action, params}, sender, callback) { +        const {targetPopupId} = params || {}; +        if (typeof targetPopupId !== 'undefined' && targetPopupId !== this.popup.id) { return; } +          const handler = this._runtimeMessageHandlers.get(action);          if (typeof handler !== 'function') { return false; } @@ -129,8 +131,20 @@ class Frontend extends TextScanner {      async updateOptions() {          this.setOptions(await apiOptionsGet(this.getOptionsContext())); + +        const ignoreNodes = ['.scan-disable', '.scan-disable *']; +        if (!this.options.scanning.enableOnPopupExpressions) { +            ignoreNodes.push('.source-text', '.source-text *'); +        } +        this.ignoreNodes = ignoreNodes.join(','); +          await this.popup.setOptions(this.options); +          this._updateContentScale(); + +        if (this.textSourceCurrent !== null && this.causeCurrent !== null) { +            await this.onSearchSource(this.textSourceCurrent, this.causeCurrent); +        }      }      async onSearchSource(textSource, cause) { |