Skip to content

Commit fcba016

Browse files
committed
Complete Day 12 - Key Sequence Detection
1 parent 1d3845e commit fcba016

4 files changed

Lines changed: 48 additions & 41 deletions

File tree

12 - Key Sequence Detection/cornify.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ var cornify_updatecount = function () {
176176
p.style.fontSize = "24px";
177177
p.style.fontFamily = "'Comic Sans MS', 'Comic Sans', 'Marker Felt', serif"; // Only the best!
178178
p.style.textTransform = "uppercase";
179+
p.style.background= "white";
180+
p.style.border = "solid 1px #ff00ff";
179181
var body = document.getElementsByTagName("body")[0];
180182
body.appendChild(p);
181183
}

12 - Key Sequence Detection/index-FINISHED.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

12 - Key Sequence Detection/index-START.html

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Key Detection</title>
6+
<script type="text/javascript" src="./cornify.js"></script>
7+
<link rel="icon" href="https://fav.farm/🔥" />
8+
</head>
9+
<body>
10+
<h1> Open the <strong>console</strong> and type "angelaread" more than once! </h1>
11+
<script>
12+
const pressed = [];
13+
const secretCode = 'angelaread';
14+
15+
window.addEventListener('keyup', (e) =>{
16+
console.log(e.key);
17+
pressed.push(e.key);
18+
pressed.splice(-secretCode.length - 1, pressed.length - secretCode.length);
19+
if(pressed.join('').includes(secretCode)){
20+
console.log('DING DING!');
21+
cornify_add();
22+
}
23+
console.log(pressed);
24+
});
25+
</script>
26+
<style>
27+
h1 {
28+
text-align:center;
29+
color:rgb(82, 36, 125);
30+
margin: 0;
31+
padding: 20px;
32+
flex: 1;
33+
font-family:'helvetica neue';
34+
font-size: 30px;
35+
font-weight: 300;
36+
background-color: white;
37+
border: solid 3px #6a3f6a;
38+
position: relative;
39+
z-index: 999999999;
40+
}
41+
body{
42+
background-color:rgb(209, 185, 230);
43+
}
44+
</style>
45+
</body>
46+
</html>

0 commit comments

Comments
 (0)