🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

Yet another keypress cheat code plugin that adds the familiar Konami Code or any pre-defined key sequence to your webpage.

cheat-code easter-egg

Documentation

Installation

1. First include jQuery before </body>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>

2. Include jKonamiCode.js

From release

<script src="jKonamiCode.js" type="text/javascript"></script>

Or from CDN hosted by jsDelivr

<script src="//cdn.jsdelivr.net/gh/Leoche/[email protected]/jKonamiCode.js" type="text/javascript"></script>

3. Initialize the plugin

<script type="text/javascript">     (function($){ // Waiting for jQuery to load         $(window).jKonamicode(function(){             // Executed when Konami code is entered             alert("My super easter egg");         });     })(jQuery); </script>

Customization

This plugin comes with a event function triggered when a right key onRightKey() is detected and have one args which is the number or right keys entered. You can also change the keyCodes if you want to have a custom code scheme.

(function($){   $(window).jKonamicode({     {code:[38,38,40,40,37,39,37,39,66,65], // Konami Code     onRightKey:function(e){         alert("You entered "+e+" right keys.");     }},      function(){ // Success function         alert("You just entered the entire konami code!");      }   ); })(jQuery);

Here is a table of all chars keyCodes: keyCodes Table


You May Also Like