-
-
Save cstrap/f33e2763e898ae70184969f7a950ad60 to your computer and use it in GitHub Desktop.
Javascript Easter Egg - Konami Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kkeys = [], | |
konami = "38,38,40,40,37,39,37,39,66,65"; | |
easterEgg = function (e) { | |
kkeys.push(e.keyCode); | |
if (kkeys.toString().indexOf(konami) == 0) { | |
var ee = $('<div id="ee">TROLOLOL</div>'); | |
ee.css({ | |
padding: '20px', | |
background: '#FFD100', | |
color: '#222', | |
font: 'bold 20px Trebuchet MS, Arial, Verdana', | |
position: 'fixed', | |
left: '29%', | |
top: '39%', | |
borderRadius: '10px', | |
display: 'none', | |
zIndex: '99999', | |
opacity: '.95', | |
boxShadow: '#111 0px 2px 16px' | |
}); | |
ee.wrapInner("<div style='position:relative'></div>"); | |
$('<a id="fechar-ee" href="#" onclick="$(this).parent().fadeOut()">x</a>').css({ | |
position: 'absolute', | |
right: '5px', | |
top: '0', | |
color: '#fff', | |
fontWeight: 'normal' | |
}).appendTo(ee); | |
$('body').append(ee); | |
$("#ee").fadeIn(); | |
$(window).unbind('keydown', easterEgg); | |
} | |
} | |
$(function () { | |
$(window).bind('keydown', easterEgg); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment