-
Notifications
You must be signed in to change notification settings - Fork 1
/
addons.html
148 lines (140 loc) · 4.05 KB
/
addons.html
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>All Perks Overlay</title>
<script src="/vue.global.min.js"></script>
<style>
body {
font-family: Verdana, serif;
color: #fff;
font-size: 22px;
}
.bg {
width: 460px;
height: 100px;
background-color: rgba(20, 20, 20, 0.6);
border-radius: 11px;
position: relative;
padding: 2px 5px;
}
.bg > span {
position: absolute;
right: 15px;
text-align: right;
top: 6px;
z-index: 99;
}
.killer {
left: 11px;
height: 100px;
}
.title {
font-weight: bold;
}
.percentage {
font-size: 17px;
}
div.addon {
margin: -2px;
}
img.addon {
width: 50px;
height: auto;
}
div.line {
display: flex;
flex-direction: row;
justify-content: space-between;
}
img.addon.disabled {
filter: brightness(17%) contrast(0.7);
}
</style>
</head>
<body>
<div id="v">
<div class="bg">
<div class="line" v-for="line in addons">
<div v-for="v in line" class="addon">
<img :src="'/img/blank-addons/' + v.img + '.png'" alt="" :class="[v.disabled ? 'disabled' : 'enabled', 'addon']">
</div>
</div>
</div>
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.2/socket.io.min.js" integrity="sha512-2ho+gY0H62N4Z9oxD422L2ZYXiOMq9l+Aub1QNz4Z4UDOtDVxz4vk6O6R3Hqqc9Y7qSvZFl7cy3+eZ/ITnUrLA==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.26.0/axios.min.js" integrity="sha512-bPh3uwgU5qEMipS/VOmRqynnMXGGSRv+72H/N260MQeXZIK4PG48401Bsby9Nq5P5fz7hy5UGNmC/W1Z51h2GQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
const v = {
data() {
return {
players: [],
addons: [],
}
},
created() {
this.fetch();
let socket = io({
transports: ["websocket"],
});
socket.on('allPerkData', (data) => {
if (data === "refresh") {
location.reload();
} else if(data){
this.parseAndDisplay(data);
}
});
},
methods: {
fetch() {
axios.get("/allPerkData").then((response) => {
this.parseAndDisplay(response.data);
});
},
parseAndDisplay(data) {
let line1 = [];
for (let i = 0; i < data.addons.b.t; i++) {
line1.push({img: "0", disabled: i < data.addons.b.q});
}
for (let i = 0; i < data.addons.p.t; i++) {
line1.push({img: "3", disabled: i < data.addons.p.q});
}
for (let i = 0; i < data.addons.i.t; i++) {
line1.push({img: "4", disabled: i < data.addons.i.q});
}
let line2 = [];
for (let i = 0; i < data.addons.y.t; i++) {
line2.push({img: "1", disabled: i < data.addons.y.q});
}
for (let i = 0; i < data.addons.g.t; i++) {
line2.push({img: "2", disabled: i < data.addons.g.q});
}
this.addons = [line1, line2];
}
}
}
Vue.createApp(v).mount('#v');
</script>
<script> // https://jsfiddle.net/bc_rikko/qwbfkv6y/2/
(async () => {
/*const count = document.getElementById("count");
const percentage = document.getElementById("percentage");
const quantity = document.getElementById("quantity");
const result = await axios.get("/allPerkData");
count.innerText = result.data.count;
percentage.innerText = result.data.percentage;
quantity.innerText = result.data.quantity;
const socket = io();
socket.on('allPerkData', function (data) {
if (data === "refresh") {
location.reload();
} else if(data){
count.innerText = data.count;
percentage.innerText = data.percentage;
quantity.innerText = data.quantity;
}
});*/
})()
</script>
</html>