-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeChef.js
38 lines (36 loc) · 1.29 KB
/
CodeChef.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
let url = "https://kontests.net/api/v1/code_chef";
let response = fetch(url);
response
.then((value) => {
return value.json();
})
.then((contests) => {
console.log(contests);
ihtml = "";
for (item in contests) {
let image =
"https://www.justalternativeto.com/wp-content/uploads/2021/07/CodeChef-735x400.jpg";
ihtml += `
<div class="card mx-2 my-2 shadow p-3 mb-5 bg-white rounded" style="width: 22rem; height:35rem;">
<img class="card-img-top " src="${image}" width = 500 height = 200 alt="Card image cap">
<div class="card-body border border-warning ">
<h5 class="card-title">${contests[item].name.slice(0, 28)}...</h5>
<p class="font-weight-bold"> Contest Organizer: ${
contests[item].site
}</p>
<p class="font-weight-bold text-danger"> Start at: ${
contests[item].start_time
} </p>
<p class="font-weight-bold text-danger"> Ends at: ${
contests[item].end_time
} </p>
<p > Status: ${contests[item].status} </p>
<a href="${
contests[item].url
}" class="btn btn-primary">Go to contest</a>
</div>
</div>
`;
}
cardContainer.innerHTML = ihtml;
});