-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
90 lines (77 loc) · 2.72 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Task#1</title>
<!-- Boxicons CSS CDN -->
<link href="https://unpkg.com/[email protected]/css/boxicons.min.css" rel="stylesheet" />
<!-- CSS -->
<link rel="stylesheet" href="./CSS/style.css" />
<!-- Meta tags: -->
<title>Random Quotes </title>
<meta name="description" content="A website for Generating Random Quotes using API">
<meta name="keywords" content="Quotes,Random Quotes">
<meta name="robots" content="index, follow">
<meta name="copyright" content="hkrobotics">
<meta name="language" content="EN">
<meta name="author" content="hkrobotics">
<meta name="creationdate" content="October 18 2021">
<meta name="distribution" content="global">
<meta name="rating" content="general">
<meta name="revisit-after" content="1 days">
</head>
<body>
<head></head>
<section class="hero">
<div class="main__container">
<div class="outer__card">
<div class="inner__card"></div>
<div class="card__1"></div>
<div class="card__2">
<i class="bx bxs-quote-alt-left left__quote"></i>
<p class="quote">
<span id="quotes">It is the supreme art of the teacher to awaken joy in creative
expression and knowledge.</span><br />
--<span id="author">Albert Einstein</span>
</p>
<i class="bx bxs-quote-alt-right right__quote"></i>
</div>
<div class="card__3"></div>
</div>
</div>
</section>
<footer></footer>
<script>
const quotes = document.getElementById("quotes");
const author = document.getElementById("author");
let realData = "";
const getNewQuotes = () => {
let rnum = Math.floor(Math.random() * realData.length);
// console.log(rnum);
// Math.floor(Math.random() * (max - min) ) + min;
//This JavaScript function always returns a random number between min and max (both included)
// console.log(realData.length);
console.log(
rnum +
"th quote was displayed using the API from https://type.fit/api/quotes"
);
// console.log(realData[rnum].author);
quotes.innerText = realData[rnum].text;
author.innerText = realData[rnum].author;
};
const getQuotes = async () => {
const api = "https://type.fit/api/quotes";
try {
let data = await fetch(api);
realData = await data.json();
getNewQuotes();
// console.log(realData[10].text);
// console.log(realData[10].author);
} catch (error) { }
};
getQuotes();
</script>
</body>
</html>