Skip to content

Commit bfcc01e

Browse files
committed
feat(translation): redo stats function
1 parent 40b6a7b commit bfcc01e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/base/translate/fixStats.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import eventManager from '../../utils/eventManager.js';
2+
3+
eventManager.on('translation:loaded', () => {
4+
const CLASSES = ['cost-color', 'atk-color', 'hp-color'];
5+
$.extend($.i18n.parser.emitter, {
6+
stats: (nodes) => CLASSES
7+
.slice(Math.max(0, 3 - nodes.length))
8+
.map((clazz, i) => nodes[i].replace(/\d+/, `<span class="${clazz}">$&</span>`))
9+
.join('/'),
10+
});
11+
});

0 commit comments

Comments
 (0)