Skip to content

hsricardo/Konami-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Konami-Code

This repository contains a simple website Konami code using jQuery.


Definition

Konami Code is a sequence of buttons used to enable a cheat in many games or revealing easter eggs on websites.

The correct sequence of buttons to be pressed is:

B A


jQuery

When the konami code is pressed, the jquery.js code can be used to change anything in the index.html file. In this example it changes the text contained in the <h3> tag.

Read the keyboard input

$(window).keydown(function (e) { });

Checks if the pressed key matches the expected sequence of value. Otherwise, reset the reading.

38 38 40 40 37 39 37 39 66 65

switch (e.which) {
	case value:
		if (cont == position) {
			cont++;
		}
		else cont = 0;
		break;
	default:
		cont = 0;
}

If the sequence is complete, execute the Easter Egg function.

var egg = function () { }

Screenshots

Original HTML screenshot: HTML Screenshot (1)

HTML screenshot after running the egg() function: HTML Screenshot (2)

About

Simple Konami Code function using jQuery.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages