Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Konstantin Nikkari
5,185 PointsKonami Code
How can you make sites like this http://konamicodesites.com that require you to press a certain keyboard combination and the reveal you something special?
1 Answer
Zhihao Wang
9,687 PointsHi Konstantin,
This is performed using JavaScript.
Basically when the website loads, it immediately starts to track the user's actions. It records the keystrokes that you take, and if it matches the "Konami code" that they specified, the script will provoke change in the html by opening up a new website, or showing an image or video.
The tracking itself is pretty advanced js and requires knowledge of JavaScript handlers, but the tracking and matching can be done through an if statement.
I hope this helped breakdown programmatic side of the site.
Cheers.
efewafewa
21,825 Pointsefewafewa
21,825 PointsThey are using JavaScript for it.
If you look at the sources, open their js folder. They have a file called all.js. Open that up and then copy and paste the code into here, http://codebeautify.org/jsviewer in the left box. Click beautify in the middle and it should show you the code on the right side.
If you like this sort of interactivity I definitely suggest taking some JavaScript courses on here.