-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
73 lines (61 loc) · 1.84 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chuck Norris Jokes</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="unholy-core.css">
<link rel="stylesheet" href="unholy-utility.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body{padding: 2%;}
* > .fa-spin-show,
*:hover > .fa-spin-hidden,
*:focus > .fa-spin-hidden {
display: none;
}
*:focus > .fa-spin-show,
*:hover > .fa-spin-show {
display: inline-block;
}
.tooltip {
position: relative;
display: inline-block;
}
</style>
</head>
<body onload="getChuck()">
<div class="container">
<div class="row">
<div class="box-medium">
<a onclick="getChuck()" class="tooltip">
<i style="font-size:48px;" class="fa fa-refresh fa-spin-hidden" alt="click to refresh"></i>
<i style="font-size:48px;color: var(--unholy-main);" class="fa fa-refresh fa-spin fa-spin-show" alt="click to refresh"></i>
</a>
<h1 id="joke">
</div>
<div class="box-medium">
<div class="wrapper">
<img id="chuckImg" class="curved shadow" src="" alt="photo of Chuck Norris">
</div>
</div>
</div>
</body>
</html>
<script>
function getChuck()
{
getJoke();
getImage();
}
function getJoke()
{
fetch('https://api.icndb.com/jokes/random?exclude=[explicit]')
.then(response => response.json())
.then(json => document.getElementById("joke").innerHTML = json["value"]["joke"])
}
function getImage()
{
document.getElementById("chuckImg").src = "images/".concat(Math.floor(Math.random() * 5) + 1 ).concat(".jpg");
}
</script>