-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathiconHelper.js
More file actions
38 lines (35 loc) · 1.14 KB
/
iconHelper.js
File metadata and controls
38 lines (35 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import tippy from 'tippy.js';
import eventManager from 'src/utils/eventManager.js';
import style from 'src/utils/style.js';
import each from 'src/utils/each.js';
// TODO: translation?
const icons = {
gold: 'Gold',
dust: 'Dust<hr>Used to craft cards',
pack: 'Undertale Pack',
packPlus: 'Undertale Pack',
drPack: 'Deltarune Pack',
drPackPlus: 'Deltarune Pack',
'shinyPack.gif': 'Shiny Pack<hr>All cards are shiny',
'superPack.gif': 'Super Pack<hr>Contains: <ul><li>Common x1</li><li>Rare x1</li><li>Epic x1</li><li>Legendary x1</li></ul>',
'finalPack.gif': 'Final Pack<hr>Contains: <ul><li>Rare x1</li><li>Epic x1</li><li>Legendary x1</li><li>Determination x1</li></ul>',
};
eventManager.on(':preload', () => {
each(icons, (text, type) => {
makeTip(`img[src="images/icons/${type}${!~type.indexOf('.') ? '.png' : ''}"]`, text);
});
});
function makeTip(selector, content) {
tippy(selector, {
content,
theme: 'undercards info',
animateFill: false,
a11y: false,
ignoreAttributes: true,
// placement: 'left',
});
}
style.add(
'.info-theme hr { margin: 5px 0; }',
'.info-theme hr + * {text-align: left;}',
);