Skip to content

Commit 3bef9b2

Browse files
authoredOct 4, 2018
Merge pull request #87 from jChris85/feature/ch/halloween_easter_egg
add easter egg for halloween page
2 parents f7575ea + fe4de31 commit 3bef9b2

File tree

2 files changed

+57
-10
lines changed

2 files changed

+57
-10
lines changed
 

‎src/haloween.html

+17-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>Welcome to Halloween Page</title>
77
<meta name="viewport" content="width=device-width, initial-scale=1">
88
<!-- Link for load boostrap -->
9-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
9+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
1010
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
1111
<!-- Link for load costum CSS-->
1212
<link rel="stylesheet" type="text/css" media="screen" href="style/style.css" />
@@ -32,6 +32,12 @@ <h1 id="page-title">🎃 Happy Halloween</h1>
3232
<div class="container">
3333
<p class="mt-5">
3434
Halloween or Hallowe'en (a contraction of All Hallows' Evening),
35+
also known as Allhalloween, All Hallows' Eve, or All
36+
Saints' Eve, is a celebration observed in a number of
37+
countries on 31 October, the eve of the Western Christian feast
38+
of All Hallows' Day. It begins the three-day observance of
39+
Allhallowtide, the time in the liturgical year dedicated to
40+
remembering the dead, including saints (hallows), martyrs, and
3541
also known as Allhalloween, All Hallows' Eve, or All
3642
Saints' Eve, is a celebration observed in a number of
3743
countries on 31 October, the eve of the Western Christian feast
@@ -56,10 +62,10 @@ <h1 id="page-title">🎃 Happy Halloween</h1>
5662
<div class="col-md-6">
5763
<div class="container">
5864
<p class="mt-5">
59-
Halloween is the season for little ghosts and goblins to take
60-
to the streets, asking for candy and scaring one another silly.
61-
Spooky stories are told around fires, scary movies appear in
62-
theaters and pumpkins are expertly (and not-so-expertly) carved
65+
Halloween is the season for little ghosts and goblins to take
66+
to the streets, asking for candy and scaring one another silly.
67+
Spooky stories are told around fires, scary movies appear in
68+
theaters and pumpkins are expertly (and not-so-expertly) carved
6369
into jack-o'-lanterns.
6470
</p>
6571
</div>
@@ -73,10 +79,10 @@ <h1 id="page-title">🎃 Happy Halloween</h1>
7379
</div>
7480
<div class="description-section" style="width:50%; margin: 0 auto;">
7581
<p class="mt-3" style="color: white; font-size: 18px; text-align: justify;">
76-
These days Halloween is not usually considered a religious holiday. It is
77-
primarily a fun day for children. Children dress up in costumes like
78-
people did a thousand years ago. But instead of worrying about evil spirits,
79-
they go from house to house. They knock on doors and say "trick or treat."
82+
These days Halloween is not usually considered a religious holiday. It is
83+
primarily a fun day for children. Children dress up in costumes like
84+
people did a thousand years ago. But instead of worrying about evil spirits,
85+
they go from house to house. They knock on doors and say "trick or treat."
8086
The owner of each house gives candy or something special to each trick or treater.
8187
</p>
8288
</div>
@@ -85,5 +91,6 @@ <h1 id="page-title">🎃 Happy Halloween</h1>
8591
<footer id="footer">
8692

8793
</footer>
94+
<script type="text/javascript" src="./scripts/easter_egg.js"></script>
8895
</body>
89-
</html>
96+
</html>

‎src/scripts/easter_egg.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Konami code
3+
*
4+
*/
5+
var allowedKeys = {
6+
37: 'left',
7+
38: 'up',
8+
39: 'right',
9+
40: 'down',
10+
65: 'a',
11+
66: 'b'
12+
};
13+
14+
var konamiCode = ['up', 'up', 'down', 'down', 'left', 'right', 'left', 'right', 'b', 'a'];
15+
var codePosition = 0;
16+
17+
document.addEventListener('keydown', function(e) {
18+
var key = allowedKeys[e.keyCode];
19+
var requiredKey = konamiCode[codePosition];
20+
21+
if (key === requiredKey) {
22+
codePosition++;
23+
24+
if (codePosition === konamiCode.length) {
25+
executeEasterEgg();
26+
codePosition = 0;
27+
}
28+
} else {
29+
codePosition = 0;
30+
}
31+
});
32+
33+
function executeEasterEgg() {
34+
var image = 'url("https://i.giphy.com/media/3o7TKUAOqDm3SQle92/giphy.webp")';
35+
36+
document.getElementById('jumbotron').style.backgroundImage = image;
37+
document.getElementById('jumbotron').style.backgroundSize = 'cover';
38+
document.body.scrollTop = 0;
39+
document.documentElement.scrollTop = 0;
40+
}

0 commit comments

Comments
 (0)
Please sign in to comment.