-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomic.html
More file actions
61 lines (36 loc) · 1.47 KB
/
comic.html
File metadata and controls
61 lines (36 loc) · 1.47 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
async function ffs() {
const email = "ra.sharipov@innopolis.university"
const params1 = new URLSearchParams( {
email: email
} )
const idResponse = await fetch ("https://fwd.innopolis.university/api/hw2?" + params1);
const id = await idResponse.json();
const params2 = new URLSearchParams({
id: id
})
const imgResponse = await fetch("https://fwd.innopolis.university/api/comic?" + params2);
const imgData = await imgResponse.json();
const imgElement = document.createElement("img")
imgElement.src = imgData.img;
imgElement.alt = imgData.alt;
const date = new Date(imgData.year, imgData.month, imgData.day).toLocaleDateString();
document.body.appendChild(imgElement);
console.log(imgElement.src);
const title = imgData.safe_title;
document.getElementById("Site").textContent = title;
document.getElementById("for-data").innerText = `${date}`;
}
ffs();
</script>
<p id="for-data"></p>
<title id="Site"></title>
</head>
<body>
</body>
</html>