forked from AnneTrue/nexus-clash-interface-tweaks
-
Notifications
You must be signed in to change notification settings - Fork 2
/
thinBars.js
41 lines (38 loc) · 1.27 KB
/
thinBars.js
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
39
40
41
const thinBars = {
module: async (api) => {
const mod = await api.registerModule(
'thinbars',
'Thin HP/MP Bars',
'local',
'If a character has full HP or MP, their resource bar is displayed thinner.',
);
const healthBars = async (mod) => {
const healthResult = document.evaluate(
"//img[@src='images/g/HealthBar_1.gif']",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
);
const len = healthResult.snapshotLength;
for (let i = 0; i < len; i++) {
healthResult.snapshotItem(i).width = '2';
}
}
const magicBars = async (mod) => {
const manaResult = document.evaluate(
"//img[@src='images/g/MagicBar_1.gif']",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
);
const len = manaResult.snapshotLength;
for (let i = 0; i < len; i++) {
manaResult.snapshotItem(i).width = '2';
}
}
await mod.registerMethod(
'async',
healthBars
);
await mod.registerMethod(
'async',
magicBars
);
}
}