The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Adding an Konami Code to your forum(Cool thing >.<)

3 posters

Go down

Solved Adding an Konami Code to your forum(Cool thing >.<)

Post by Saxaca Wed 18 Aug - 12:44

What is the code for an Konami code?

You know, the Up-Up-Down-Down-Left-Right-Left-Right-B-A thing?

(TheFaceBookForum has it >.<)


Last edited by Santa Sauce on Wed 18 Aug - 15:13; edited 1 time in total
Saxaca
Saxaca
Forumember

Male Posts : 539
Reputation : 26
Language : Markup.

Back to top Go down

Solved Re: Adding an Konami Code to your forum(Cool thing >.<)

Post by Laughing Assassin Wed 18 Aug - 14:12

ok found a couple of codes for this,

The Code
In case you don't know, the Konami Code is:

Up, Up, Down, Down, Left, Right, Left, Right, B, A, Start

For our purposes, we've replaced Start with Enter.

The JavaScript Code
The code is being hosted over at Google Code where you can download the examples and original source:

http://code.google.com/p/konami-js/

The beauty of hosting it there is you can just copy and paste the examples below. No need to download anything.

Simplest Example
The most basic example takes the user to Google when they enter the code correctly. Just add this in the homepage message

Code:
<script type="text/javascript" src="http://konami-js.googlecode.com/svn/trunk/konami.js"></script>
<script type="text/javascript">
   konami = new Konami()
   konami.load("http://www.google.com");
</script>
The default behavior is to redirect the browser to whatever web address is passed to konami.load()

Second Simplest Example
A slightly more complicated examples show how you can redefine konami.code() and have it alert with a pop-up message instead:

Code:
<script type="text/javascript" src="http://konami-js.googlecode.com/svn/trunk/konami.js"></script>
<script type="text/javascript">
   konami = new Konami()
   konami.code = function() {
      alert("You have entered the KONAMI CODE!  You now have 30 lives.  Kinda.")
      }

   konami.load()
</script>
When the user enters the Konami Code on this page, he or she is greeted with a message informing them that they've just acquired 30 lives. Sort of. Redfining konami.code() opens the door to do some fun things. You could even hook it into your Google Analytics tracking and measure when your users enter the code, for whatever that's worth.


Third Simplest Example
Maybe you want some other combination of keys to trigger a special event on your page? No problem. Just redefine the konami.pattern variable to match the sequence of keyCodes you want. This example would match the user hitting up twelve times:

Code:
<script type="text/javascript" src="http://konami-js.googlecode.com/svn/trunk/konami.js"></script>
<script type="text/javascript">
   konami = new Konami()
   konami.pattern = "383838383838383838383838"
   konami.code = function() {
      alert("You have hit up four times.  Why you did this, I don't know.")
      }

   konami.load()
</script>


this info is from http://www.snaptortoise.com/konami-js/



avatar
Laughing Assassin
Forumember

Male Posts : 91
Reputation : 0
Language : English

http://legacyofassassins.forumotion.com/forum.htm

Back to top Go down

Solved Re: Adding an Konami Code to your forum(Cool thing >.<)

Post by Saxaca Wed 18 Aug - 14:22

Ok, but i want this in an HTML page, and to redirect to another HTML page. tongue

But thanks for the explanation, i'll try to modify the codes a little to see what i can do. Wink
Saxaca
Saxaca
Forumember

Male Posts : 539
Reputation : 26
Language : Markup.

Back to top Go down

Solved Re: Adding an Konami Code to your forum(Cool thing >.<)

Post by Laughing Assassin Wed 18 Aug - 14:31

this code works fine in a html page, use the first code and just change the url in this line

Code:
konami.load("http://www.google.com");

with the url you wanna redirect to.
avatar
Laughing Assassin
Forumember

Male Posts : 91
Reputation : 0
Language : English

http://legacyofassassins.forumotion.com/forum.htm

Back to top Go down

Solved Re: Adding an Konami Code to your forum(Cool thing >.<)

Post by Saxaca Wed 18 Aug - 15:12

Yes, i've figured that out by now >.< But thanks!

--> Solved!
Saxaca
Saxaca
Forumember

Male Posts : 539
Reputation : 26
Language : Markup.

Back to top Go down

Solved Re: Adding an Konami Code to your forum(Cool thing >.<)

Post by Sanket Wed 18 Aug - 23:44

Since this thread is marked solved, I will lock this thread.
Adding an Konami Code to your forum(Cool thing >.<) 2j4t5a8

Sanket Smile

Sanket
Sanket
ForumGuru

Male Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum