-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkonami.html
More file actions
37 lines (33 loc) · 1.03 KB
/
konami.html
File metadata and controls
37 lines (33 loc) · 1.03 KB
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
<!DOCTYPE html>
<html lang="">
<head>
<title>Konami Code</title>
</head>
<body>
<h1>Konami Code</h1>
<!--ASCII codes for konami: 38 38 40 40 37 39 37 39 66 65 13-->
<script src="https://code.jquery.com/jquery-3.6.3.js" integrity="sha256-nQLuAZGRRcILA+6dMBOvcRh5Pe310sBpanc6+QBmyVM=" crossorigin="anonymous"></script>
<script>
"use strict";
const userCode = [];
console.log(userCode);
const konamiCode = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13];
$(document).keyup(function(event){
// console.log(event.keyCode);
if (userCode.length < 11){
userCode.push(event.keyCode);
} else {
userCode.shift();
userCode.push(event.keyCode);
}
// the content that displays when code entered
if(userCode.toString() === konamiCode.toString()){
$("body").css("background-image","url(img/konami/ezgif.com-gif-maker.gif) ");
$("body").css("background-repeat","no-repeat");
$("body").css("background-size","cover");
}
});
console.log(konamiCode.toString());
</script>
</body>
</html>