-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
66 lines (61 loc) · 2.28 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=\, initial-scale=1.0">
<title>QUOTES</title>
<script src="https://kit.fontawesome.com/c66557c71b.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="logo">
</div>
<h1 class="header"><i class="fas fa-globe-europe" style="color: red;"></i> ADITYA QUOTES FACTORY <i class="fas fa-globe-europe" style="color: red;"></i></h1>
<div class="container">
<div class="inner">
<div class="box">
<div class="text">
<div class="qc">
<i class="fas fa-quote-left"></i>
<p id="quotes"> </p>
<i class="fas fa-quote-right"></i>
<p id="author"> </p>
</div>
<label class="button">
<p id="newq">New Quotes</p>
</label>
</div>
</div>
</div>
<script>
const quotes = document.getElementById("quotes");
const author = document.getElementById("author");
const newq = document.getElementById("newq");
let realData = " ";
const getNewQuotes = () => {
let rnum = Math.floor(Math.random() * 1600);
console.log(realData[rnum]);
quotes.innerText = `${realData[rnum].text}`;
if (realData[rnum].author == null) {
author.innerText = "--unKnown";
}
else {
author.innerText = `--${realData[rnum].author}`;
}
}
const getQuotes = async () => {
try {
const api = "https://type.fit/api/quotes"
let data = await fetch(api);
realData = await data.json();
getNewQuotes();
} catch (error) {
}
};
newq.addEventListener('click', getNewQuotes);
getQuotes();
</script>
<link rel="stylesheet" href="css/bootstrap.css">
</body>
</html>