-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
259 lines (245 loc) · 9.25 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>epicsitio75</title>
</head>
<body style="background-color: brown">
<link rel="shortcut icon" type="image/x-icon" href="epicicon75.ico">
<img src="https://media.discordapp.net/attachments/919659532911784028/1172980029039321208/ezgif.com-gif-maker_1.gif?ex=656249c7&is=654fd4c7&hm=e25a73d8b48645cc4672741f453b6083c618d761b0218c419c8545ad869148b2&=" height="200" alt="">
<p style="color: #00AA00; font-family: 'gabarito',serif; font-size: 80px; margin: 0; text-align: center">🌌 <u>bienvenidos al epic sitio 75</u> ☀️</p>
<img src="https://cdn.discordapp.com/attachments/919659532911784028/1172980028523417650/bill_ls.gif?ex=656249c7&is=654fd4c7&hm=a3d9aaa4e4e53853a1539d490932392b02ba4dec547063438a2100bb54405714&" height="200" alt="">
<div class="button">
<a href="./el_reloj">reloj</a>
<p id="subtitulo" onclick="updateCounter()">has hecho clic en mi 0 veces</p>
<p id="p2" onclick="onClick1()">el boton</p>
<p id="p3" onclick="onClick2()">el segundo botón</p>
<p id="p4" onclick="onClick3()">el tercer botón</p>
<p id="p5" onclick="onClick4()">the fourth button</p>
<p id="p6" onclick="onClick5()">the fifth button</p>
<p id="p7" onclick="onClick6()">the sixth button</p>
<p id="p8" onclick="onClick7()">el séptimo botón</p>
<p id="p9" onclick="onClick8()">el octavo botón</p>
<p id="p10" onclick="onClick9()">el noveno botón</p>
</div>
<style>
.button p, a {
color: #00AA00;
font-size: 50px;
font-family: 'gabarito',serif;
margin: 0;
}
@font-face {
font-family: gabarito;
src:
url(./gabarito.ttf);
}
</style>
</body>
</html>
<script>
let variable = 0;
function updateCounter() {
let var2 = variable;
variable++;
document.getElementById("subtitulo").innerText = "has hecho clic en mi "+variable+" veces";
console.log("UPDATED NUMBER! "+var2+" -> "+variable);
}
function onClick1() {
alert("explosión");
}
function onClick2() {
let nombre = prompt("cual es tu nombre?");
alert(nombre + "? wow!!! me gusta mucho ... que lindo nombre");
}
// brooke: create a function that says "you win" 10% of the time and "you lose" 90%
function onClick3() {
let random = Math.random();
if (random <= 0.1) {
console.log(random);
alert("u win! ("+random+")");
} else {
console.log(random);
alert("u lose..... ("+random+")");
}
}
// kelly: make a palindrome checker
function isPalindrome(word){
// a palindrome is a word that is the same forward and backward
// palindromes: racecar, abcba, hannah
// not palindromes: abcde, steve, ticha
let array1 = [];
let arrayPos = 0;
let check = false;
for (let i = word.length-1; i >= 0; i--) {
array1.push(word[i]);
console.log(array1[arrayPos]);
arrayPos++;
}
array1 = array1.join("");
console.log(array1);
if (array1 === word) {
check = true;
}
return check;
}
function onClick4() {
let word = prompt("Enter a string to check?");
if(isPalindrome(word)) alert("Your word is a palindrome!");
else alert("Your word is not a palindrome.");
}
// create a function that is given the starting number, then returns the collatz sequence
// ex collatzSequence(13) returns [13,40,20,10,5,16,8,4,2,1]
function collatzSequence(n){
let sequence = [n];
let num = n;
let arrayPos = 0;
let hasFinished = false;
while (hasFinished === false) {
if (num%2 === 0) {
num = num/2
sequence.push(num);
console.log(sequence[arrayPos]);
} else {
num = 3*num+1;
sequence.push(num);
console.log(sequence[arrayPos]);
}
if (num === 1) {
hasFinished = true;
console.log(num);
} else {
arrayPos++
}
if (num === Infinity || isNaN(num) || num < 0) {
console.error("why");
hasFinished = true;
}
}
console.log(sequence);
return sequence;
}
function onClick5(){
let start = parseInt(prompt("What is your starting number?"));
let sequence = collatzSequence(start);
alert("The sequence is: " + sequence.join(" -> "));
}
function shatteredcake(width, pieces){
let n = pieces.length;
let w = width;
let area = [];
for (let i = 0; i <= n-1; i++) {
area.push(pieces[i][0]*pieces[i][1]);
}
let result = 0;
for (let i = 0; i <= n-1; i++) {
result = result + area[i];
}
result = result/w;
return result;
}
function onClick6() {
console.log(shatteredcake(4,[[2,3],[1,4],[1,2],[1,2],[2,2],[2,2],[2,1]]));
}
let segundos = 10;
function disminuirBomba() {
if(segundos > 0) {
segundos -= 0.01;
setTimeout(onClick7, 5);
}
}
function onClick7() {
if(segundos > 0) document.getElementById("p8").innerText = "explosión en " + segundos.toFixed(2);
else document.getElementById("p8").innerText = "búm (o algo)";
setTimeout(disminuirBomba, 0);
}
// comment
let juegoActivo = false;
let puntos = 0;
let sec = 0;
let timeout = null;
function onClick8() {
if (juegoActivo) {
clearTimeout(timeout);
switch (true) {
case (sec >= 5.00):
puntos = 0;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - UPS!!!! te has pasado!!! puntos: "+puntos;
break;
case (sec < 4.50):
puntos = 0;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - muy pronto!!!! intenta acercarte más a los 5 segundos. puntos: "+puntos;
break;
case (sec >= 4.50 && sec < 4.75):
puntos = 10;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - nada mal!! puntos: "+puntos;
break;
case (sec >= 4.75 && sec < 4.85):
puntos = 20;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - muy bien!! puntos: "+puntos;
break;
case (sec >= 4.85 && sec < 4.90):
puntos = 30;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - muy bien!! puntos: "+puntos;
break;
case (sec >= 4.90 && sec < 4.95):
puntos = 50;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - wow!!!! puntos: "+puntos;
break;
case (sec === 4.95 || sec === 4.96):
puntos = 75;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - wow!!!!!!! puntos: "+puntos;
break;
case (sec === 4.96 || sec === 4.97):
puntos = 85;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - wow!!!!!!!!!!! puntos: "+puntos;
break;
case (sec >= 4.98 && sec < 5):
puntos = 100;
document.getElementById("p9").innerText = sec.toFixed(2)+"s - que habilidad!!!!! puntos: "+puntos;
break;
default:
console.warn("umm????");
break;
}
sec = 0;
juegoActivo = false;
} else {
juegoActivo = true;
setTimeout(actualizarTimer, 0);
}
}
function actualizarTimer() {
sec += 0.01;
document.getElementById("p9").innerText = sec.toFixed(2) + "s";
timeout = setTimeout(actualizarTimer, 10);
}
let data;
let foundDragonEgg;
let endOfArray;
async function onClick9() {
const response = await fetch("https://raw.githubusercontent.com/BrookeAFK/brookeafk-api/main/events.js");
data = await response.json();
let i = 0;
foundDragonEgg = false;
endOfArray = false;
while (foundDragonEgg === false && endOfArray === false) {
if (data[i]["event"] === "Dragon Egg") {
console.log("FOUND! dragon egg in data["+i+"]['event']");
if (data[i]["timestamp"] < Date.now()) {
console.log("this event already happened. skipping...");
i++;
} else {
console.log("we have a winner (hasn't happened yet)");
foundDragonEgg = true;
}
} else if (i === data.length-1) {
console.log("no dragon eggs were found");
endOfArray = true;
} else i++;
}
let time = new Date(data[i]["timestamp"]);
console.log(time);
alert("next dragon egg event is on: "+time);
}
</script>