-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkonami.html
More file actions
44 lines (36 loc) · 1019 Bytes
/
konami.html
File metadata and controls
44 lines (36 loc) · 1019 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Konami Code </title>
</head>
<body>
<h1>Konami Code</h1>
<div id="KonamiSecret">
</div>
<script src="/js/jquery.js"></script>
<script>
"use strict";
let fresh = 0;
function goKonamiCode() {
alert("You added 30 lives!")
const KCdisplay =document.createElement("h1")
const KCmessage = document.createTextNode("Congrats, you're old!")
KCdisplay.appendChild(KCmessage)
const KC = document.getElementById("KonamiSecret")
document.body.insertBefore(KCdisplay,KC)
}
function test() {
$('body').css('background-color', 'darkred')
$('h1').css("color", "green")
}
const KONAMI_CODE = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13];
document.addEventListener('keydown', (e) => {
fresh = (e.keyCode == KONAMI_CODE[fresh]) ? fresh + 1 : 0;
if (fresh == KONAMI_CODE.length) goKonamiCode(), test();
});
$(document).keyup(function(event){
console.log(event.keyCode);
});
</script>
</body>
</html>