-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbadguys.html
185 lines (120 loc) · 4.71 KB
/
badguys.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="styleguilty.css">
<link href="https://fonts.googleapis.com/css?family=Patua+One" rel="stylesheet">
<title>Guilty</title>
</head>
<body>
<div class = "container">
<h1 class= "text-center">CONGRATULATIONS! YOU GOT THE CULPRITS!</h1>
<h2 class= "text-center">CLICK one picture to PUNCH one of the culprits and get the truth</h2>
<div class="row">
<div class="col-12 col-md-4 ">
<div id="perso1" class="img-responsive"></div>
<div id="infosPerso1"></div>
</div>
<div class=" col-12 col-md-4 ">
<div id ="perso2" class="img-responsive"></div>
<div id="infosperso2"></div>
</div>
<div class="col-12 col-md-4 ">
<div id="perso3" class="img-responsive"></div>
<div id="infosperso3"></div>
</div>
</div>
</div>
// JS
<script type="module">
// PERSO1
const perso1Id = document.getElementById('perso1');
const infosperso1= document.getElementById('infosperso1');
const fetcher1 = () => {
// Fichier json perso1
let value = Math.floor(Math.random()*731)
return fetch(`https://cdn.rawgit.com/akabab/superhero-api/0.2.0/api/id/${value}.json`)
.then(resp => {
if (resp.status !== 200) {
return fetcher()
}
return resp.json()
})
}
fetcher1()
.then(json=>{
let imgSource = json.images.md
//insertion de l'image perso1
perso1.innerHTML = (`<a href=\"theBoss.html\"><img class=\"imground\"src = ${imgSource}>`)
// insertion infos Perso1
infosPerso1.innerHTML = `Full name : ${json.biography.fullName} <br>
Family : ${json.connections.relatives}
Place of Birth : unknown <br> `
})
// PERSO 2
//get l'id perso2 sur le DOM
const perso2Id = document.getElementById('perso2');
const infosperso2= document.getElementById('infosperso2');
const fetcher = () => {
// Fichier json perso2
let value1 = Math.floor(Math.random()*731)
return fetch(`https://cdn.rawgit.com/akabab/superhero-api/0.2.0/api/id/${value1}.json`)
.then(resp => {
if (resp.status !== 200) {
return fetcher()
}
return resp.json()
})
}
fetcher()
.then(json=>{
let imgSource1 = json.images.md
//insertion de l'image perso2
perso2.innerHTML = (`<a href=\"theBoss.html\"><img class=\"imground\"src = ${imgSource1}>`)
// insertion infos Perso2
infosperso2.innerHTML = `Full name : ${json.biography.fullName} <br>
Family : ${json.connections.relatives}
Place of Birth : unknown <br> `
})
// Perso 3
//get l'id red hood sur le DOM
const perso3Id = document.getElementById('perso3');
const infosperso3= document.getElementById('infosperso3');
const fetcher3 = () => {
// Fichier json perso3
let value2 = Math.floor(Math.random()*731)
return fetch(`https://cdn.rawgit.com/akabab/superhero-api/0.2.0/api/id/${value2}.json`)
.then(resp => {
if (resp.status !== 200) {
return fetcher()
}
return resp.json()
})
}
fetcher3()
.then(json=>{
let imgSource = json.images.md
//insertion de l'image perso3
perso3.innerHTML = (`<a href=\"theBoss.html\"><img class=\"imground\"src = ${imgSource}>`)
// insertion infos Perso3
infosperso3.innerHTML = `Full name : ${json.biography.fullName} <br>
Family : ${json.connections.relatives}
Place of Birth : unknown <br> `
})
// API DEEZER
(function(d, s, id) {
var js, djs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://e-cdns-files.dzcdn.net/js/widget/loader.js";
djs.parentNode.insertBefore(js, djs);
}(document, "script", "deezer-widget-loader"));</script>
</script>
<div class="deezer-widget-player" data-src="https://www.deezer.com/plugins/player?format=classic&autoplay=true&playlist=true&width=700&height=350&color=007FEB&layout=dark&size=medium&type=tracks&id=58391811&app_id=1" data-scrolling="no" data-frameborder="0" data-allowTransparency="true" data-width="700" data-height="240"></div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>