forked from bin2209/innocode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtft.html
More file actions
407 lines (336 loc) · 16.3 KB
/
Copy pathtft.html
File metadata and controls
407 lines (336 loc) · 16.3 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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>League of Legends </title>
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/styles.css" rel="stylesheet">
<!-- Import font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noticia+Text:ital,wght@0,400;0,700;1,400;1,700&display=swap"
rel="stylesheet">
<!-- Import Swiper -->
<link rel="stylesheet" href="assets/css/swiper-bundle.min.css" />
<script src="assets/js/swiper-bundle.min.js"></script>
<script src="assets/js/jquery-3.6.0.min.js"></script>
</head>
<body>
<!-- NAVBAR -->
<nav id="legends-nav" class="legends-nav navbar navbar-expand-lg bg-body-tertiary bg-legends">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo03"
aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="mobile-search search">
<div class="search-icon"><img src="assets/images/search.png" /></div>
<input type="search" class="form-control btn btn-primary text-uppercase rounded-pill mx-2" />
</div>
<a class="navbar-brand" href="index.html">
<img src="assets/images/logo.svg" alt="logo" />
</a>
<div class="collapse navbar-collapse justify-content-between row" id="navbarTogglerDemo03">
<ul class="navbar-nav col-12 col-md-5">
<li class="nav-item active d-flex">
<a class="nav-link " aria-current="page" href="game.html">Game</a>
</li>
<li class="nav-item d-flex">
<a class="nav-link" href="champion.html">Champion</a><span
class="badge badge-pill badge-success">New</span>
</li>
<li class="nav-item d-flex">
<a class="nav-link" href="tft.html">Tactics</a><span class="badge badge-pill badge-success"
style="margin: 0 0em 2em 7em;">New</span>
</li>
<li class="nav-item hide-desktop-flex" style="display:none;">
<a class="nav-link" href="news.html">News</a>
</li>
</ul>
<div class="logo col-2 text-center">
<a href="index.html"> <img src="assets/images/logo.svg" alt="logo"></a>
</div>
<div class="col-5 login d-flex justify-content-between align-items-center">
<li class="nav-item d-flex">
<a class="nav-link" href="news.html">News</a>
</li>
<div class="search d-flex align-items-center ">
<div class="search-icon"><img src="assets/images/search.png" /></div>
<input id="inputField" type="search"
class="form-control btn btn-primary text-uppercase rounded-pill mx-2" />
</div>
<button type="button" class="btn btn-primary text-uppercase">Đăng nhập</button>
</div>
</div>
</div>
</nav>
<!-- homepage -->
<section class="section-tft">
<div class="container">
<div class="row">
<div class="col-12 col-md-12 text-center branding">
<img src="assets/images/tft-logo.png" alt="tft-image" class="tft-image">
</div>
<div class="col-12 col-md-12 text-center">
<div class="play-btn-container justify-content-center">
<div class="outline-play-btn">
</div>
<button class="play-btn">
Play now
</button>
</div>
</div>
</div>
</div>
</section>
<!-- CHAMPION -->
<!-- MODAL -->
<div class="modal fade " id="championsModal" tabindex="-1" role="dialog" aria-labelledby="championsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered " role="document">
<div class="modal-content overplay-blur">
<div class="modal-header">
<h3 class="modal-title" id="championsModalLabel">Champions</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body ">
<div class="container-fluid">
<div id="modal-body" class="row">
</div>
</div>
<!-- Champions will be displayed here -->
</div>
</div>
</div>
</div>
<!-- MODAL -->
<!-- Menu Section -->
<section class="section-champions px-3">
<div class="container ">
<div class="row bottom-50 champion-name-banner-mb ">
<h2 class="col-12 primary-color py-4 ">Traits</h2>
</div>
<div id="traits-container" class="row"></div>
<div class="row bottom-50 champion-name-banner-mb ">
<h2 class="col-12 primary-color py-4 ">Champions</h2>
</div>
<div class="filter-tft">
<data id="champions-filter" class="row">
<div class="col-6 col-md-3 col-lg-2 mb-3">
<div class="legends-btn">
<button onclick="filterChampions('All')">
<h3>All</h3>
</button>
</div>
</div>
<div class="col-6 col-md-3 col-lg-2 mb-3">
<div class="legends-btn">
<button onclick="filterChampions('1')">
<h3>1 Star</h3>
</button>
</div>
</div>
<div class="col-6 col-md-3 col-lg-2 mb-3">
<div class="legends-btn">
<button onclick="filterChampions('2')">
<h3>2 Star</h3>
</button>
</div>
</div>
<div class="col-6 col-md-3 col-lg-2 mb-3">
<div class="legends-btn">
<button onclick="filterChampions('3')">
<h3>3 Star</h3>
</button>
</div>
</div>
<div class="col-6 col-md-3 col-lg-2 mb-3">
<div class="legends-btn">
<button onclick="filterChampions('4')">
<h3>4 Star</h3>
</button>
</div>
</div>
<div class="col-6 col-md-3 col-lg-2 mb-3">
<div class="legends-btn">
<button onclick="filterChampions('5')">
<h3>5 Star</h3>
</button>
</div>
</div>
</data>
<div id="champions-container" class="row"></div>
</div>
<script> // Function to fetch traits data
// Function to fetch traits data
async function fetchTraits() {
try {
const response = await fetch('/assets/data/en_US/tft-trait.json');
const data = await response.json();
const traitsArray = Object.values(data.data);
// Filter out traits that start with 'TFTTutorial_' and 'TFTEvent5YR_'
const filteredTraits = traitsArray.filter(trait => {
return !trait.id.startsWith('TFTTutorial_') && !trait.id.startsWith('TFTEvent5YR_');
});
return filteredTraits;
} catch (error) {
console.error('Error fetching trait data:', error);
return [];
}
}
// Function to fetch champions data
async function fetchChampions() {
try {
const response = await fetch('/assets/data/en_US/tft-champion.json');
const data = await response.json();
const championsArray = Object.values(data.data);
// Filter out champions that start with 'TFTTutorial_'
const filteredChampions = championsArray.filter(champion => {
return !champion.id.startsWith('TFTTutorial_');
});
return filteredChampions;
} catch (error) {
console.error('Error fetching champion data:', error);
return [];
}
}
// Function to display all traits
async function displayTraits() {
const traits = await fetchTraits();
const champions = await fetchChampions();
const container = document.getElementById('traits-container');
container.innerHTML = '';
traits.forEach(trait => {
const formattedName = formatName(trait.name);
// Determine if the trait id starts with 'TFTEvent5YR_'
const isEventTrait = trait.id.startsWith('TFTEvent5YR_');
container.innerHTML += `
<div class="traits-item col-4 col-sm-3 col-md-2 col-lg-2 p-3">
<div class="trait text-center ${isEventTrait ? 'TFTEvent' : ''}" data-trait-id="${trait.id}">
<img src="/assets/data/en_US/tft/tft-trait/${trait.image.full}" alt="${trait.name} icon">
<h4>${trait.name}</h4>
</div>
</div>
`;
});
// Add click event listener to each trait
document.querySelectorAll('.trait').forEach(element => {
element.addEventListener('click', function() {
const traitId = this.getAttribute('data-trait-id');
showChampionsInTrait(traitId, champions);
});
});
}
// Function to display champions in the modal based on the clicked trait
function showChampionsInTrait(traitId, champions) {
traitId = traitId.replace('TFT11_', ''); // Remove 'TFT_' from the traitId
const modalBody = document.getElementById('modal-body');
if (!modalBody) {
console.error('Modal body not found');
return;
}
modalBody.innerHTML = '';
// Log the traitId to ensure it's correct
console.log(traitId);
const championsWithTrait = champions.filter(champion => {
// console.log('Trait ID:', champion.image.traitId);
// console.log('Champion:', champion.name, 'Traits:', champion['trait-id']);
// Debug log
return champion['trait-id'] && champion['trait-id'].includes(traitId);
});
const championsHTML = championsWithTrait.map(champion => `
<div class="p-2 col-6 col-sm-3 col-md-4 ">
<div class="champion text-center ">
<img class="champion-cover" src="/assets/data/en_US/tft/tft-champion/${champion.image.full}" alt="Kindred icon">
<div class="row">
<h4 class="col">${champion.name}</h4>
<span class="col">${champion.tier.toString()}<img class="coin-icon" src="/assets/data/en_US/tft/tft-region-portal/Coins_Icon.png"></span>
</div>
</div>
</div>
`).join('');
modalBody.innerHTML = championsHTML;
$('#championsModal').modal('show');
}
// Function to display champions based on selected tier (coins)
async function displayChampions(tierFilter) {
const champions = await fetchChampions();
const container = document.getElementById('champions-container');
container.innerHTML = '';
champions.forEach(champion => {
const formattedName = formatName(champion.name);
// Determine if the champion id starts with 'TFTEvent5YR_'
const isEventChampion = champion.id.startsWith('TFTEvent5YR_');
// Check if the champion's tier matches the selected tierFilter
if (tierFilter === 'All' || champion.tier.toString() === tierFilter) {
container.innerHTML += `
<div class="col-4 col-sm-3 col-md-2 col-lg-2 p-3">
<div class="champion text-center ${isEventChampion ? 'TFTEvent' : ''}">
<img class="champion-cover" src="/assets/data/en_US/tft/tft-champion/${champion.image.full}" alt="${champion.name} icon">
<div class="row">
<h4 class="col">${champion.name}</h4>
<span class="col">${champion.tier.toString()} <img class="coin-icon" src="/assets/data/en_US/tft/tft-region-portal/Coins_Icon.png"/></span>
</div>
</div>
</div>
`;
}
});
}
// Function to filter champions by tier (coins)
async function filterChampions(tier) {
await displayChampions(tier);
}
// Initial setup
async function initialize() {
await displayTraits();
await displayChampions('All'); // Display all champions initially
}
initialize();
// Function to format the name (stub for potential future use)
function formatName(name) {
// Implement any necessary name formatting logic here
return name.replace(/\s+/g, '-').toLowerCase();
}
</script>
</div>
</section>
<!-- footer -->
<footer>
<div class="container">
<div class="row">
<div class="col-12 col">
<div class="footer-logo d-flex justify-content-center">
<img src="assets/images/riot.png" alt="logo" height="100px">
<img src="assets/images/vng.png" alt="logo" height="100px">
</div>
</div>
<div class="col-12 col-sm-7 m-auto text-center mt-5">
<p>2009-2022 by Riot Games Corporation. LEAGUE OF LEGENDS and related logos are trademarks, service
marks
and/or registered trademarks of Riot Games Corporation.</p>
</div>
</div>
</div>
</footer>
<!-- footer -->
<script>
</script>
<script>
$('#inputField').keypress(function (event) {
if (event.which === 13) { // Enter key pressed
var inputVal = $('#inputField').val();
window.location.href = `/search.html?s=${inputVal}`;
}
});
</script>
<script src="assets/js/main.js"></script>
<script src="assets/js/swiper.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> -->
<!-- Bootstrap JS and dependencies (Popper.js and jQuery) -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>