-
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) · 1.16 KB
/
konami.html
File metadata and controls
44 lines (36 loc) · 1.16 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
38
39
40
41
42
43
44
<!DOCTYPE html>
<html>
<head>
<title>Konami Code</title>
</head>
<body>
<h1>Konami Code</h1>
<section class="row">
<div class="col">
<h2>Enter konami code</h2>
<form action="" method="POST" name="user">
<div class="form-group">
<label for="text">Enter Konami code</label>
<input class="form-control" type="text" name="first" id="text" placeholder="Enter the code"
autocomplete="off">
</div>
<button type="button" class="btn btn-primary btn-block" id="submitBtn">Submit</button>
</form>
</div>
</section>
<script src="js/jquery-3.5.1.js"></script>
<script>
"use strict";
var pressedKeys = [];
$(document).keyup(function (event) {
pressedKeys.push(event.keyCode)
console.log(pressedKeys);
if (JSON.stringify(konamiCode) === JSON.stringify(pressedKeys)) {
$("body").css("background-image", "url('img/extra_life.png')").css({"background-size": "30%"});
alert("You have added 30 lives!")
}
})
var konamiCode = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13];
</script>
</body>
</html>