-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkonami.html
67 lines (53 loc) · 1.5 KB
/
konami.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
<!DOCTYPE html>
<html>
<head>
<title>Konami Code</title>
</head>
<body>
<h1>Konami Code</h1>
<h1 id="currentKey" style="display: none"></h1>
<img id="pizza" src="img/giphy.gif" height="480" width="480" style="display: none"/>
<script src="js/jquery.js"></script>
<script>
(function () {
"use strict";
/**
* 37 - left
* 38 - up
* 39 - right
* 40 down
* 65 a
* 66 b
* 13 enter
*
* ↑ ↑ ↓ ↓ ← → ← → b a
*/
$(document).ready
{
var key = "38384040373937396665";
var currentKey = "";
$(document).keyup(function (event) {
// Check if the user presses the return key
if (event.keyCode === 13) {
// Check the current key against the key
if (currentKey === key) {
alert('we have a winner!!');
$("#pizza").show();
$("#currentKey").html('');
} else {
alert('try again!');
// You have to try again
currentKey = "";
$("#pizza").hide();
}
} else {
// Save the types key code
currentKey += event.keyCode;
$("#pizza").hide();
}
});
}
})();
</script>
</body>
</html>