-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.php
254 lines (224 loc) · 9.93 KB
/
display.php
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Valorant Map Pick and Ban - Results</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@700&display=swap" rel="stylesheet">
<!-- Importing a similar font -->
<style>
@font-face {
font-family: 'Montserrat';
src: url('https://fonts.cdnfonts.com/s/12002/BurbankBigCondensed-Bold.woff') format('woff');
/* Use actual Valorant font if available */
}
body {
font-family: 'Montserrat', sans-serif;
/* Fallback font */
background: transparent;
/* Make the background transparent */
}
.map-box {
position: relative;
overflow: hidden;
border-radius: 0.5rem;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
width: 12vw;
height: 20vw;
max-width: 200px;
max-height: 300px;
background: url('https://images.prismic.io/rivalryglhf/3965b309-0510-4285-8aab-596753ed6ec9_Valorant-Maps.webp') no-repeat center center;
background-size: cover;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-family: 'Montserrat', 'Oswald', sans-serif;
font-size: 1.5rem;
font-weight: bold;
text-align: center;
}
.map-box img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 0.5rem;
display: none;
/* Hide initially */
}
.map-info {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
text-align: center;
color: white;
text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
/* Hide initially */
font-size: 0.8rem;
font-weight: bold;
text-transform: uppercase;
}
.map-info .team {
margin-top: 10px;
background-color: rgba(0, 0, 0, 0.7);
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-size: 1rem;
}
.map-info .side {
margin-bottom: 10px;
background-color: rgba(0, 0, 0, 0.7);
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-size: 0.7rem;
}
.map-name {
display: none;
/* Hide initially */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 1.5rem;
font-weight: bold;
color: white;
text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
/* Animation for data change */
.animate-change {
animation: bounceIn 1s ease forwards;
/* Ensure animation plays only once */
}
@keyframes bounceIn {
0% {
opacity: 0;
transform: scale(0.3);
}
50% {
opacity: 1;
transform: scale(1.05);
}
70% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
</style>
</head>
<body class="text-white">
<div class="container mx-auto py-10">
<h1 class="text-5xl font-bold mb-12 text-center">
<span class="text-transparent bg-clip-text bg-gradient-to-r from-red-500 to-yellow-500"></span>
</h1>
<div id="maps-container" class="flex flex-nowrap justify-center gap-4 overflow-x-auto">
<!-- 7 map boxes with default states -->
<?php
for ($i = 0; $i < 7; $i++) {
echo '<div class="map-box" data-map="">
<img src="" alt="">
<div class="map-info">
<div class="team"></div>
<div class="side"></div>
<div class="map-name"></div>
</div>
</div>';
}
?>
</div>
</div>
<script>
const mapsData = {
"Abyss": "https://wiser.com.np/map/maps/Loading_Screen_Abyss.webp",
"Ascent": "https://wiser.com.np/map/maps/Loading_Screen_Ascent.webp",
"Bind": "https://wiser.com.np/map/maps/Loading_Screen_Bind.webp",
"Haven": "https://wiser.com.np/map/maps/Loading_Screen_Haven.webp",
"Pearl": "https://wiser.com.np/map/maps/Loading_Screen_Pearl.webp",
"Split": "https://wiser.com.np/map/maps/Loading_Screen_Split.webp",
"Sunset": "https://wiser.com.np/map/maps/Loading_Screen_Sunset.webp",
// "Lotus": "https://wiser.com.np/map/maps/Loading_Screen_Lotus.webp",
// "Bind": "https://wiser.com.np/map/maps/Loading_Screen_Bind.webp",
// "Split": "https://wiser.com.np/map/maps/Loading_Screen_Split.webp",
// "Ascent": "https://wiser.com.np/map/maps/Loading_Screen_Ascent.webp",
// "Icebox": "https://wiser.com.np/map/maps/Loading_Screen_Icebox.webp",
// "Breeze": "https://wiser.com.np/map/maps/Loading_Screen_Breeze.webp",
// "Sunset": "https://wiser.com.np/map/maps/Loading_Screen_Sunset.webp",
// "Fracture":"https://wiser.com.np/map/maps/Loading_Screen_Fracture.webp"
};
let previousChoices = [];
function loadChoices() {
fetch('getChoices.php')
.then(response => response.json())
.then(choices => {
console.log('Choices received:', choices); // Log the received choices
const container = document.getElementById('maps-container');
choices.forEach(choice => {
let mapBox = Array.from(container.children).find(box => box.dataset.map === choice.map);
if (!mapBox) {
// Use the next available empty map box
mapBox = Array.from(container.children).find(box => box.dataset.map === "");
mapBox.dataset.map = choice.map;
}
if (mapBox) {
const imgEl = mapBox.querySelector('img');
const teamEl = mapBox.querySelector('.team');
const sideEl = mapBox.querySelector('.side');
const mapNameEl = mapBox.querySelector('.map-name');
console.log('Updating map box:', {
map: choice.map,
team: choice.team,
action: choice.action,
side: choice.side,
oppositeTeam: choice.oppositeTeam
});
imgEl.src = mapsData[choice.map];
imgEl.alt = choice.map;
imgEl.style.display = 'block';
mapNameEl.textContent = choice.map;
mapNameEl.style.display = 'block';
teamEl.textContent = `${choice.team} ${choice.action === 'Pick' ? 'picked' : 'banned'}`;
sideEl.textContent = choice.action === 'Pick' ? `${choice.oppositeTeam} chose ${choice.side}` : '';
mapBox.querySelector('.map-info').style.opacity = 1; // Show the map info
mapBox.style.background = 'none'; // Remove the gradient background
// Check if the choice is new or updated
const isUpdated = !previousChoices.some(prev =>
prev.map === choice.map &&
prev.team === choice.team &&
prev.action === choice.action &&
prev.side === choice.side &&
prev.oppositeTeam === choice.oppositeTeam
);
if (isUpdated) {
// Add animation class for the updated map box
mapBox.classList.add('animate-change');
// Remove the animation class after the animation completes
mapBox.addEventListener('animationend', () => {
mapBox.classList.remove('animate-change');
}, {
once: true
}); // Ensure the event listener is removed after it runs
}
}
});
// Update previous choices
previousChoices = JSON.parse(JSON.stringify(choices));
})
.catch(error => console.error('Error fetching choices:', error));
}
window.onload = function() {
loadChoices();
setInterval(loadChoices, 5000); // Refresh every 5 seconds
}
</script>
</body>
</html>