Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit e380f58

Browse files
journey-adEYHN
authored andcommitted
fix dialog style load
1 parent 22f3ee3 commit e380f58

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/dialog/index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { tapbodyEmitter } from './emitter/tapbody';
77
import { tapfaceEmitter } from './emitter/tapface';
88
import { hitokotoVariable } from './variable/hitokoto';
99

10-
document.head.innerHTML += `
11-
<style>
10+
const dialogStyle = document.createElement('style');
11+
dialogStyle.innerHTML = `
1212
.live2d-widget-dialog-container {
1313
width: 300px;
1414
height: 120px;
@@ -39,9 +39,8 @@ document.head.innerHTML += `
3939
@keyframes live2d-widget-dialog-tingle {
4040
0% { transform: translate(-1px, 1.5px) rotate(-2deg); }
4141
100% { transform: translate(1px, -1.5px) rotate(2deg); }
42-
}
43-
</style>
44-
`;
42+
}`;
43+
document.head.appendChild(dialogStyle);
4544

4645
let containerElement,dialogElement,closeTimer;
4746

@@ -52,7 +51,7 @@ let containerElement,dialogElement,closeTimer;
5251
function createDialogElement(root) {
5352
containerElement = document.createElement('div');
5453
containerElement.className = 'live2d-widget-dialog-container';
55-
containerElement.style.transform = `scale(${config.display.width / 250})`
54+
containerElement.style.transform = `scale(${config.display.width / 250})`;
5655
dialogElement = document.createElement('div');
5756
dialogElement.className = 'live2d-widget-dialog';
5857
containerElement.appendChild(dialogElement);
@@ -70,7 +69,7 @@ function createDialogElement(root) {
7069
scriptEngine.registerVariable('hitokoto', hitokotoVariable);
7170
Object.keys(config.dialog.script).forEach(key => {
7271
scriptEngine.run(key, config.dialog.script[key]);
73-
})
72+
});
7473
}
7574
}
7675

@@ -93,4 +92,4 @@ function alertText(text) {
9392

9493
module.exports = {
9594
createDialogElement, displayDialog, hiddenDialog, alertText
96-
}
95+
};

0 commit comments

Comments
 (0)