-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRmxhZ3tXZWxrb21fYmlqX2RlX0NvZGVyZG9qb19DVEYhfQ==.html
192 lines (167 loc) · 5.72 KB
/
RmxhZ3tXZWxrb21fYmlqX2RlX0NvZGVyZG9qb19DVEYhfQ==.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
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript Calculator - CoderDojo</title>
<style>
body {
font-family: 'Courier New', Courier, monospace;
background-color: black;
color: #b3ff00;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
}
.container {
text-align: center;
width: 100%;
max-width: 350px;
padding: 30px;
background-color: rgba(42, 42, 42, 0.9);
color: #b3ff00;
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
position: relative;
z-index: 1;
}
h1 {
color: #b3ff00;
margin-bottom: 20px;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
h4 {
color: #cfcfcf;
font-size: 1.1em;
margin-bottom: 20px;
}
input[type=number] {
width: 100%;
padding: 12px;
margin-bottom: 15px;
border-radius: 6px;
border: none;
background-color: #333;
color: #b3ff00;
font-size: 1rem;
}
button {
width: 100%;
padding: 12px;
border: none;
border-radius: 6px;
background-color: #b3ff00;
color: #2a2a2a;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease;
margin-bottom: 15px;
}
button:hover {
background-color: #99cc00;
}
#r, #m {
font-size: 1.1em;
font-weight: bold;
margin-top: 10px;
color: #b3ff00;
}
#hBtn {
background-color: #666;
color: #b3ff00;
}
#hBtn:disabled {
background-color: #444;
color: #999;
cursor: not-allowed;
}
/* Achtergrond met vallende neon letters */
.background {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 0;
font-size: 20px;
white-space: nowrap;
overflow: hidden;
filter: blur(5px);
}
.letter {
position: absolute;
top: -50px;
color: rgba(179, 255, 0, 0.7);
text-shadow: 0 0 10px rgba(179, 255, 0, 0.7);
animation: drop linear infinite;
}
@keyframes drop {
0% { transform: translateY(0); }
100% { transform: translateY(100vh); }
}
</style>
</head>
<body>
<div class="background"></div>
<div class="container">
<h2>Opdracht 2:<h2>
<h1>Ontgrendel de Geheime Kluis!</h1>
<h4>Gebruik de calculator en vind de geheime waarde om de kluis te openen. Na 7 pogingen krijg je een hint!</h4>
<input type="number" id="a" placeholder="Getal 1">
<input type="number" id="b" placeholder="Getal 2">
<button onclick="calculate()">Bereken</button>
<p id="r"></p>
<p id="m"></p>
<button id="hBtn" onclick="showHint()" disabled>Hint</button>
</div>
<script>
function generateLetters() {
const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const background = document.querySelector('.background');
const numberOfLetters = 100;
for (let i = 0; i < numberOfLetters; i++) {
const letter = document.createElement('div');
letter.classList.add('letter');
letter.textContent = letters.charAt(Math.floor(Math.random() * letters.length));
letter.style.left = Math.random() * 100 + 'vw';
letter.style.fontSize = Math.random() * 20 + 20 + 'px';
letter.style.animationDuration = Math.random() * 3 + 2 + 's';
letter.style.animationDelay = Math.random() * 5 + 's';
background.appendChild(letter);
}
}
generateLetters();
let attempts = 0;
const encodedAnswer = "MjE=";
const encodedFlagParts = ["Rmxh", "Z3tN", "YXVkLU", "1hcml", "0X2lzX", "zIxX2", "phYXJ", "fb3Vk", "fQ=="];
const encodedHint = "SG9lIG91ZCBpcyBNYXVkLU1hcml0Pw==";
function decodeBase64(encodedString) {
return atob(encodedString);
}
function calculate() {
const n1 = parseInt(document.getElementById("a").value);
const n2 = parseInt(document.getElementById("b").value);
const result = n1 + n2;
document.getElementById("r").innerText = "Resultaat: " + result;
const expectedAnswer = parseInt(decodeBase64(encodedAnswer));
if (result === expectedAnswer) {
const decodedFlag = atob(encodedFlagParts.join(""));
document.getElementById("m").innerHTML = "<a style='decoration: none; color: #b3ff00;' href='" + encodedFlagParts.join("") + ".html'>" + decodedFlag + "</a>";
} else {
document.getElementById("m").innerText = "Probeer een andere combinatie.";
}
attempts++;
if (attempts >= 7) {
document.getElementById("hBtn").removeAttribute("disabled");
}
}
function showHint() {
const hint = decodeBase64(encodedHint);
alert("Hint: " + hint);
}
</script>
</body>
</html>