diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-11-03 22:30:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-03 22:30:20 -0500 |
commit | 255c8b724e036d9d38e1dab4540974d11fc00bfa (patch) | |
tree | f2dd58cf25f82e2db6d640023c7650455ca83018 /ext/mixed/js | |
parent | 838175f06baca9503dca4180b01853a0a2afd734 (diff) |
Pitch accents preview (#987)
* Add public preparePitchAccents function to DisplayGenerator
* Add pitch accents preview HTML, CSS, and JS
Diffstat (limited to 'ext/mixed/js')
-rw-r--r-- | ext/mixed/js/display-generator.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js index 926eb25d..910d45da 100644 --- a/ext/mixed/js/display-generator.js +++ b/ext/mixed/js/display-generator.js @@ -34,6 +34,13 @@ class DisplayGenerator { this._templates = new HtmlTemplateCollection(html); } + preparePitchAccents() { + if (this._termPitchAccentStaticTemplateIsSetup) { return; } + this._termPitchAccentStaticTemplateIsSetup = true; + const t = this._templates.instantiate('term-pitch-accent-static'); + document.head.appendChild(t); + } + createTermEntry(details) { const node = this._templates.instantiate('term-entry'); @@ -357,11 +364,7 @@ class DisplayGenerator { } _createPitches(details) { - if (!this._termPitchAccentStaticTemplateIsSetup) { - this._termPitchAccentStaticTemplateIsSetup = true; - const t = this._templates.instantiate('term-pitch-accent-static'); - document.head.appendChild(t); - } + this.preparePitchAccents(); const {dictionary, pitches} = details; |