summaryrefslogtreecommitdiff
path: root/ext/mixed
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-03 22:30:20 -0500
committerGitHub <noreply@github.com>2020-11-03 22:30:20 -0500
commit255c8b724e036d9d38e1dab4540974d11fc00bfa (patch)
treef2dd58cf25f82e2db6d640023c7650455ca83018 /ext/mixed
parent838175f06baca9503dca4180b01853a0a2afd734 (diff)
Pitch accents preview (#987)
* Add public preparePitchAccents function to DisplayGenerator * Add pitch accents preview HTML, CSS, and JS
Diffstat (limited to 'ext/mixed')
-rw-r--r--ext/mixed/js/display-generator.js13
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;