The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

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

View previous topic View next topic Go down

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

Post by Saxaca on August 18th 2010, 11:44 am

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 August 18th 2010, 2:13 pm; edited 1 time in total

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 on August 18th 2010, 1:12 pm

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/




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 on August 18th 2010, 1:22 pm

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
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 on August 18th 2010, 1:31 pm

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.

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 on August 18th 2010, 2:12 pm

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

--> Solved!

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 on August 18th 2010, 10:44 pm

Since this thread is marked solved, I will lock this thread.


Sanket Smile


Sanket
ForumGuru

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

http://webartzforum.com

Back to top Go down

View previous topic View next topic Back to top


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