Konami-JS

A quick and silly script for adding the Konami Code easter egg to your site. Compatible with gestures on smartphones and tablets as well.

Download View On GitHub

About This Project

Every site should have an implementation of the Konami Code. It makes things more fun! If you're unfamiliar with it, the Konami Code is a "cheat code" that appeared in many of Konami's video games going all the way back to 1986. It was typically entered on a Nintendo controller. Now it's often used on websites to show silly things to visitors when the code is "unlocked."

Konami-JS includes support for gestures on smartphones and tablets. Technically the code becomes "up, up, down, down, left, right, left, right, tap, tap," on these devices but... that's close enough!

Support for touch gestures is automatically loaded when konami.load() is called.

Installing

You can install Konami-JS several ways with npm:

npm install konami

Or with Bower:

bower install konami-js

Or you can download the files from GitHub and stick konami.js in your project.

Getting Started

The simplest version of a Konami-JS implementation looks like this:

var easter_egg = new Konami('http://your-special-easter-egg-website.com');

This will redirect the user to a specified website upon successfully completing the Konami Code.

You can also pass a function instead of a string:

var easter_egg = new Konami(function() { alert('Konami Code!')});

This will call the function when the code is successfully entered.

Coming Soon

Future Improvements

Konami-JS is an ancient project by JavaScript standards, having started in 2009! I would love for 2018 to be the year it gets rewritten in a more modern, ES6-friendly way while incorporating something like Babel to ensure backwards compatibility in older browsers.

I would love the community's help in any of this 😃

Lastly, you can watch me talk about the history of Konami-JS and the value of maintaining "frivolous" open-source projects here at OdessaJS 2017:

As Seen On...