diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-12 14:55:18 -0400 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-12 15:31:29 -0400 | 
| commit | 6da76835524fbf6b95902f06822d77c54ccf735b (patch) | |
| tree | 89b479b925e0bb48a89258710c442dac407a3fd7 /ext/mixed/js | |
| parent | a5b208fb895d46793223910451d177dc53d9463a (diff) | |
Don't pass options around for calls to termsShow, kanjiShow, etc.
Diffstat (limited to 'ext/mixed/js')
| -rw-r--r-- | ext/mixed/js/display.js | 18 | 
1 files changed, 10 insertions, 8 deletions
| diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index d5d055e0..b3ddae72 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -76,7 +76,7 @@ class Display {              }              const kanjiDefs = await apiKanjiFind(link.textContent, this.getOptionsContext()); -            this.kanjiShow(kanjiDefs, this.options, context); +            this.kanjiShow(kanjiDefs, context);          } catch (e) {              this.onError(e);          } @@ -125,7 +125,7 @@ class Display {                  context.source.source = this.context.source;              } -            this.termsShow(definitions, this.options, context); +            this.termsShow(definitions, context);          } catch (e) {              this.onError(e);          } @@ -239,10 +239,12 @@ class Display {          });      } -    async termsShow(definitions, options, context) { +    async termsShow(definitions, context) {          if (!this.isInitialized()) { return; }          try { +            const options = this.options; +              this.setEventListenersActive(false);              if (!context || context.focus !== false) { @@ -250,7 +252,6 @@ class Display {              }              this.definitions = definitions; -            this.options = options;              this.context = context;              const sequence = ++this.sequence; @@ -280,7 +281,7 @@ class Display {              const {index, scroll} = context || {};              this.entryScrollIntoView(index || 0, scroll); -            if (this.options.audio.enabled && this.options.audio.autoPlay) { +            if (options.audio.enabled && options.audio.autoPlay) {                  this.autoPlayAudio();              } @@ -292,10 +293,12 @@ class Display {          }      } -    async kanjiShow(definitions, options, context) { +    async kanjiShow(definitions, context) {          if (!this.isInitialized()) { return; }          try { +            const options = this.options; +              this.setEventListenersActive(false);              if (!context || context.focus !== false) { @@ -303,7 +306,6 @@ class Display {              }              this.definitions = definitions; -            this.options = options;              this.context = context;              const sequence = ++this.sequence; @@ -415,7 +417,7 @@ class Display {                  source: this.context.source.source              }; -            this.termsShow(this.context.source.definitions, this.options, context); +            this.termsShow(this.context.source.definitions, context);          }      } |