Inspired by Konami Code Sites I decided to write a simple jQuery plugin which you can use to easily add your own secret ‘cheat code’ style commands to your own website. By default the “Cheat Code” plugin looks for the Konami code pressed anywhere on the website and can be activated only once.
You can easily change the code required to activate the reveal, as well as define your own ‘activation’ function for an interesting easter egg. By default, the cheat code can only be activated once, but this can be change.
Download…
Want to use “Cheat Code” on your own website? No problem. You can download the full version.
Run Code…
This page makes use of Run Code, a simple jquery plugin which converts your code examples to live behaviour.
Examples…
Basic Usage
Simply apply the plugin to the document, and the plugin will automatically add a Konami Code cheat code easter egg.
$(document).cheatCode();
Set the Code
Override the default cheat code combination with your own and allow the code to continue to work after activated.
$(document).cheatCode({
code : '38,40,37,39',
unbind : false,
message : 'Up,Down,Left,Right'
});
Reveal your Secret
You can set your own reveal when the cheat code is successfully activated by using the activated option.
$(document).cheatCode({
code : '38,38,40,40,65,66',
activated : function(){
alert('My secret…')
}
});