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.

Project History

Konami-JS is an ancient project by JavaScript standards, having started in 2009. It was created by George Mandis.

Watch George talk about the history of Konami-JS and the value of maintaining "frivolous" open-source projects here at OdessaJS 2017:

Listen to George talk about the general history of Konami-JS:

JS Party 81: The story of Konami-JS – Listen on Changelog.com

As Seen On...