aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display-generator.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/display-generator.js')
-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;