-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
327 lines (241 loc) · 12.4 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
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE html>
<html lang="en">
<head>
<!-- las siguientes lineas son para agregar Bootstrap de manera online -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<!-- para usar font awesome inline-->
<script src="https://use.fontawesome.com/ef22b1a80e.js"></script>
<!-- para usar bootstrap localmente -->
<!-- <link rel="stylesheet" href="bootstrap.min.css"> -->
<!-- <script src="bootstrap.bundle.min.js"></script> -->
<!-- para usar fontawesome localmente-->
<!-- <link rel="stylesheet" href="all.min.css"> -->
<!-- <script src="all.min.js"></script> -->
<!--linkeo al achivo css-->
<link href="styles.css" rel="stylesheet">
<!-- para que en celulares no se vea demasiado chico-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<script rel="javascript">
document.addEventListener('DOMContentLoaded', comienzo);
function comienzo()
{
nombreFoto = document.getElementsByClassName("nombreFoto");
for(var i = 0; i < nombreFoto.length; i++){
nombreFoto.item(i).addEventListener("click", mostrarNombreFoto);
}
boton = document.getElementById("btnTaTeTi");
tatetiDiv = document.getElementById("tatetiDiv");
tatetiDiv.style.display = "none";
boton.addEventListener("click", function(){
tatetiDiv.style.display = "inline";
boton.remove();
// casillero = document.getElementsById("tablaTateti").getElementsByTagName("button");
casilleros = document.getElementById("tablaTateti").getElementsByTagName("td");
for(var i=0; i< casilleros.length; i++){
casilleros.item(i).addEventListener("click", marcar);
}
}
)
}
function mostrarNombreFoto(){
fotoTarjeta = document.getElementsByClassName("fotoOculta").item(0);
fotoTarjeta.style.visibility = "visible";
fotoTarjeta.addEventListener("click", function(){
this.style.visibility = "hidden";
})
}
var marcador = 0;
//este marcador va a ir alternando entre 0 y 1 según sea el turno de X o de O...
var gameover = 0;
function marcar(ev){
if (marcador == 9 || gameover == 1){
// alert("the game is over");
reset();
return 0;
} else if (ev.target.innerHTML != "")
{
// alert("that place is already taken");
return 0;
}else if(marcador % 2 == 0){
ev.target.innerHTML = "X";
marcador++;
check(ev);
}
else{
ev.target.innerHTML = "O";
marcador++;
check(ev);
}
}
function check(ev){
c1 = casilleros.item(0);
c2 = casilleros.item(1);
c3 = casilleros.item(2);
c4 = casilleros.item(3);
c5 = casilleros.item(4);
c6 = casilleros.item(5);
c7 = casilleros.item(6);
c8 = casilleros.item(7);
c9 = casilleros.item(8);
if (c1.innerHTML == c2.innerHTML && c2.innerHTML == c3.innerHTML && c1.innerHTML != ""){
c1.style.backgroundColor='green';
c2.style.backgroundColor='green';
c3.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
if (c4.innerHTML == c5.innerHTML && c5.innerHTML == c6.innerHTML && c4.innerHTML != ""){
c4.style.backgroundColor='green';
c5.style.backgroundColor='green';
c6.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
if (c7.innerHTML == c8.innerHTML && c8.innerHTML == c9.innerHTML && c7.innerHTML != ""){
c7.style.backgroundColor='green';
c8.style.backgroundColor='green';
c9.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
if (c1.innerHTML == c5.innerHTML && c5.innerHTML == c9.innerHTML && c1.innerHTML != ""){
c1.style.backgroundColor='green';
c5.style.backgroundColor='green';
c9.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
if (c3.innerHTML == c5.innerHTML && c5.innerHTML == c7.innerHTML && c3.innerHTML != ""){
c3.style.backgroundColor='green';
c5.style.backgroundColor='green';
c7.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
if (c1.innerHTML == c4.innerHTML && c4.innerHTML == c7.innerHTML && c1.innerHTML != ""){
c1.style.backgroundColor='green';
c4.style.backgroundColor='green';
c7.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
if (c2.innerHTML == c5.innerHTML && c5.innerHTML == c8.innerHTML && c2.innerHTML != ""){
c2.style.backgroundColor='green';
c5.style.backgroundColor='green';
c8.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
if (c3.innerHTML == c6.innerHTML && c6.innerHTML == c9.innerHTML && c3.innerHTML != ""){
c3.style.backgroundColor='green';
c6.style.backgroundColor='green';
c9.style.backgroundColor='green';
// alert("ganaron las " + ev.target.innerHTML);
gameover = 1;
}
}
function reset(){
for (var i = 0; i < 9; i++){
casilleros.item(i).innerHTML = "";
casilleros.item(i).style.backgroundColor = 'black';
}
marcador = 0;
gameover = 0;
}
</script>
<title>My Webpage</title>
</head>
<body>
<main class="container-fluid bg-light">
<div class="p-5 rounded text-center">
<h1>Welcome to my first Webpage</h1>
<p class="lead">You´ll learn some things about me and, hopefully, have some fun!</p>
</div>
<div class="rounded mt-3">
<div class="row">
<div class="container-fluid text-center">
<a class="btn btn-lg btn-primary" href="#" role="button" id="btnTaTeTi">Play tic tac toe »</a>
</div>
</div>
<div class="row" id="tatetiDiv">
<table id="tablaTateti" class="tabla">
<tr>
<td id="casillero1"></td>
<td id="casillero2"></td>
<td id="casillero3"></td>
</tr>
<tr>
<td id="casillero4"></td>
<td id="casillero5"></td>
<td id="casillero6"></td>
</tr>
<tr>
<td id="casillero7"></td>
<td id="casillero8"></td>
<td id="casillero9"></td>
</tr>
</table>
</div>
</div>
<br>
<br>
<br>
<div class="container-fluid fotoOculta">
<div class="card">
<div class="card-header"></div>
<span class="m-2 text-center"><img class="img-thumbnail" src="/images/logo_mini.jpg" alt=""></span>
<div class="card-body text-center">
<h5 class="card-title">Nicolás Cirio</h5>
<!-- <p class="card-text"> -->
<ul class="listaMiniCv">
<li>34 years old.</li>
<li>Married with Belu.</li>
<li>Father of Pili and Joaco.</li>
</ul>
<!-- </p> -->
</div>
</div>
</div>
</main>
<nav class="navbar fixed-bottom navbar-expand-sm navbar-dark bg-dark">
<div class="container-fluid">
<span class="mr-2 nombreFoto"><img class="img-thumbnail" src="/images/logo_mini.jpg" alt="" height="50" width="50"></span>
<a class="navbar-brand nombreFoto" href="#">Nicolás Cirio</a>
<a href="https://www.instagram.com/nicocirio/" class="mr-2"><i class="fa fa-instagram"></i></a>
<a href="https://www.facebook.com/nicocirio" class="mr-2"><i class="fa fa-facebook"></i></a>
<a href="https://www.twitter.com/nicocirio" class="mr-2"><i class="fa fa-twitter"></i></a>
<a href="https://www.linkedin.com/in/nicol%C3%A1s-cirio-94966119/" class="mr-2"><i class="fa fa-linkedin"></i></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav">
<li class="nav-item active">
<b><a class="nav-link" aria-current="page" href="index.html">Home</a></b>
</li>
<li class="nav-item">
<a class="nav-link" href="family.html">Family</a>
</li>
<li class="nav-item">
<a class="nav-link" href="studies.html">Studies</a>
</li>
<li class="nav-item">
<a class="nav-link" href="hobbies.html">Hobbies</a>
</li>
<li class="nav-item dropup">
<a class="nav-link dropdown-toggle" href="#" id="dropdown10" data-bs-toggle="dropdown" aria-expanded="false">Other links</a>
<ul class="dropdown-menu" aria-labelledby="dropdown10">
<li><a class="dropdown-item" href="https://getbootstrap.com/">Bootstrap</a></li>
<li><a class="dropdown-item" href="https://code.visualstudio.com/">Visual Studio Code</a></li>
<li><a class="dropdown-item" href="https://fontawesome.com/">Font Awesome</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
</body>
</html>