Giter Site home page Giter Site logo

josuebasurto / konami-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from georgemandis/konami-js

0.0 1.0 0.0 189 KB

A quick and silly script for adding the konami code easter egg to your site. Works with gestures on iPhone as well. Examples can be find at the Google Code site.

Home Page: http://snaptortoise.com/konami-js/

JavaScript 100.00%

konami-js's Introduction

Konami-JS

Important Update

NOTE: I've decided to simplify the repository. Just the JavaScript file and the README, with some links to examples.

Recently I started receiving requests to including Konami-JS in a variety of JavaScript module loaders. If that feature is important to you I'd encourage you to fork the repo and implement it yourself โ€” I have no plans of introducing anything like that here.

Simplified Implementation

Previously the simplest version of a Konami-JS implementation looked like this:

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

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

You could also pass along a function to execute when the easter egg is completed. The simplest version of that looked like this:

var easter_egg = new Konami();
easter_egg.code = function() { alert('Konami code!'); }
easter_egg.load();

That is even sillier than the other implementation.

You can now set either the URL to redirect to OR the function to execute when you instantiate the class:

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

OR:

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

A passed string is assumed to be the URL to redirect to. A passed function will be executed when the code is successfully entered:

This is why you do code reviews more often than once ever two years.

Overview

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. Recently, ESPN received attention for the funny, flashy things that would happen when the code was entered on their website. Those shenanigans were the inspiration for whipping up this script.

Gesture Support

As of version 1.1, Konami-JS includes support for gestures on iOS and Android devices. Technically the code becomes "up, up, down, down, left, right, left, right, tap, tap, tap," on these devices but that's close enough!

Support for touch gestures is automatically loaded when konami.load() is called. See the example page for details on how to deliver touch-specific easter eggs.

As Seen On...

konami-js's People

Contributors

georgemandis avatar josuebasurto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.