diff options
Diffstat (limited to 'konami')
| -rw-r--r-- | konami/.htaccess | 1 | ||||
| -rw-r--r-- | konami/assets/audio/midi.mp3 | bin | 0 -> 7304844 bytes | |||
| -rw-r--r-- | konami/assets/audio/midi.mp3.txt | 31 | ||||
| -rw-r--r-- | konami/assets/bg/bg.gif | bin | 0 -> 97044 bytes | |||
| -rw-r--r-- | konami/assets/images/Email2.gif | bin | 0 -> 7739 bytes | |||
| -rw-r--r-- | konami/assets/images/bullet.png | bin | 0 -> 3736 bytes | |||
| -rw-r--r-- | konami/assets/images/cd-rom.gif | bin | 0 -> 2994 bytes | |||
| -rw-r--r-- | konami/assets/images/geoshape.gif | bin | 0 -> 2596 bytes | |||
| -rw-r--r-- | konami/assets/images/small-spinning-globe3.gif | bin | 0 -> 94800 bytes | |||
| -rw-r--r-- | konami/assets/images/smiley face cursor.cur | bin | 0 -> 4286 bytes | |||
| -rw-r--r-- | konami/bypass/index.html | 134 | ||||
| -rw-r--r-- | konami/css/main.css | 297 | ||||
| -rw-r--r-- | konami/index.html | 120 | ||||
| -rw-r--r-- | konami/js/main.js | 220 |
14 files changed, 803 insertions, 0 deletions
diff --git a/konami/.htaccess b/konami/.htaccess new file mode 100644 index 0000000..45552cb --- /dev/null +++ b/konami/.htaccess @@ -0,0 +1 @@ +Options -Indexes
\ No newline at end of file diff --git a/konami/assets/audio/midi.mp3 b/konami/assets/audio/midi.mp3 Binary files differnew file mode 100644 index 0000000..2f6bbe4 --- /dev/null +++ b/konami/assets/audio/midi.mp3 diff --git a/konami/assets/audio/midi.mp3.txt b/konami/assets/audio/midi.mp3.txt new file mode 100644 index 0000000..3b8e91b --- /dev/null +++ b/konami/assets/audio/midi.mp3.txt @@ -0,0 +1,31 @@ + // CREDITS: // + +Title: The Classics - A New Retro Synthwave Mix + +Uploader: Confused Bi-Product of a Misinformed Culture + +YouTube Video Link: https://www.youtube.com/watch?v=5WVhdmNiuuM&t=76s + +Full Credits of ALL Artists: +00:00 - LazerHawk - Space is the Place +01:57 - Tokyo Rose - Need For Speed +04:08 - Daniel Deluxe - Night Stalker +06:37 - OGRE - Negotiation's Over +07:35 - Tokyo Rose - Tokyo Burnout +09:30 - Dynatron - Rise to the Stars +13:13 - LazerHawk - Electric Groove +17:55 - Arcade High - Outrun This! +20:53 - Zombie Hyperdrive - Red Eyes +24:07 - Dynatron - Propulsion Overdrive +26:56 - d.notive - Hell's Highway +28:14 - Grum - Power +30:31 - Dynatron - Unquestionable Judgment +35:10 - OGRE - The Bench +38:07 - DANCE WITH THE DEAD - Venom +40:28 - Danger Mode - Road Rage +43:42 - LazerHawk - King of the Streets +46:27 - Wice - Cruise Control +49:41 - KN1GHT - Osaka +53:37 - Trevor Something - Miami Nights + +Note: I cut the track at 10:00 minutes, so the credits of the artists exceed my track limit, I just wanted to include everyone.
\ No newline at end of file diff --git a/konami/assets/bg/bg.gif b/konami/assets/bg/bg.gif Binary files differnew file mode 100644 index 0000000..29f21e8 --- /dev/null +++ b/konami/assets/bg/bg.gif diff --git a/konami/assets/images/Email2.gif b/konami/assets/images/Email2.gif Binary files differnew file mode 100644 index 0000000..bfbcaad --- /dev/null +++ b/konami/assets/images/Email2.gif diff --git a/konami/assets/images/bullet.png b/konami/assets/images/bullet.png Binary files differnew file mode 100644 index 0000000..d234fc2 --- /dev/null +++ b/konami/assets/images/bullet.png diff --git a/konami/assets/images/cd-rom.gif b/konami/assets/images/cd-rom.gif Binary files differnew file mode 100644 index 0000000..9bbfb95 --- /dev/null +++ b/konami/assets/images/cd-rom.gif diff --git a/konami/assets/images/geoshape.gif b/konami/assets/images/geoshape.gif Binary files differnew file mode 100644 index 0000000..2e6b5c2 --- /dev/null +++ b/konami/assets/images/geoshape.gif diff --git a/konami/assets/images/small-spinning-globe3.gif b/konami/assets/images/small-spinning-globe3.gif Binary files differnew file mode 100644 index 0000000..e562772 --- /dev/null +++ b/konami/assets/images/small-spinning-globe3.gif diff --git a/konami/assets/images/smiley face cursor.cur b/konami/assets/images/smiley face cursor.cur Binary files differnew file mode 100644 index 0000000..36fd0f2 --- /dev/null +++ b/konami/assets/images/smiley face cursor.cur diff --git a/konami/bypass/index.html b/konami/bypass/index.html new file mode 100644 index 0000000..a8d6824 --- /dev/null +++ b/konami/bypass/index.html @@ -0,0 +1,134 @@ +<!DOCTYPE html> +<html lang="en"> + + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <meta name="theme-color" content="#FFF"> + <title>s1nical - Landing Page</title> + <!-- External Libraries --> + <link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic' rel='stylesheet' type='text/css'> + <script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/0.3.1/trianglify.min.js"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> + <script src="https://code.jquery.com/jquery-1.10.2.js"></script> + <script src="https://rawgit.com/WeiChiaChang/Easter-egg/master/easter-eggs-collection.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css"></script> + <!-- CSS Links --> + <link rel="stylesheet" href="/konami/css/main.css"> + <!-- Invisable Scripts --> + <script src="/konami/js/main.js"></script> + <script src="/js/refresh-on-media.js"></script> + <!-- Site metadata --> + <meta name="description" content="Konami Archive Bypass"> + <meta property="og:description" content="Konami Archive Bypass"> + <meta property="og:title" content="s1nical - Landing Page"> + <meta property="twitter:card" content="summary"> + <meta property="twitter:site" content="@9inny"> + <meta property="og:image" content=""> + <meta property="og:url" content="https://cyne.cf/konami/bypass"> + <!-- Favicons --> + <link rel="apple-touch-icon" sizes="128x128" href="/konami/assets/images/small-spinning-globe3.gif"> + <link rel="icon" type="image/gif" href="/konami/assets/images/small-spinning-globe3.gif" sizes="128x128"> + <link rel="canonical" href="https://cyne.cf/konami/bypass"> + <script type="application/ld+json"> + { + "name": "s1nical", + "alternateName": "s1n", + "description": "Konami Archive Bypass", + "headline": "Konami Archive Bypass", + "url": "https://cyne.cf/konami/bypass", + "image": "", + "sameAs": [ + "https://twitter.com/9inny", + "https://github.com/8cy", + "https://www.reddit.com/user/s1nical/", + ], + "publisher": { + "@type": "Organization", + "logo": { + "@type": "ImageObject", + "url": "" + } + }, + "@type": "WebSite", + "@context": "http://schema.org" + } + </script> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/inter.css" + integrity="sha256-DyLTj16AbuvawyWJMPz4tJNp46iGflE/fWYAoU2IGpk=" crossorigin="anonymous"> + </head> + + <body> + + <!-- Navigation Bar --> + <div class="navigation-bar"> + <nav class="nav"> + <a href="/home/" class="nav-item" active-color="orange">Home</a> <!-- Had `is-active` after it but removed it due to not highlighting. --> + <a href="/about/" class="nav-item" active-color="green">About</a> + <a href="https://cyne.cf/status" class="nav-item" active-color="red">Status</a> + <a href="/directory/" class="nav-item" active-color="rebeccapurple">Directory</a> + <span class="nav-indicator"></span> + </nav> + </div> + + <!-- Core Site Function, Site Primer/ Base --> + <main> + <div class="links"> + <div class="email"> + <a href="mailto:[email protected]">s1nical</a><br> + Full-stack developer.<br><br> + </div> + <div class="twitter"> + Follow me on <a href="https://twitter.com/9inny">Twitter</a>. + </div> + <div class="github"> + View my code on <a href="https://github.com/8cy">GitHub</a>. + </div> + </div> + </main> + + <div class="ee"> + <!-- Toasty --> + <img class='toasty' src='https://s3-eu-west-1.amazonaws.com/wdildnproject2/toasty.png'> + <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> + + <!-- Marty --> + <audio class="marty" src="https://jigowatt.co.uk/wp-content/themes/client/dist/audio/marty.mp3" preload="auto"></audio> + <img class="marty" src="https://jigowatt.co.uk/wp-content/themes/client/dist/img/marty.png" alt="marty"> + + <!-- Doc --> + <audio class="docbrown" src="https://jigowatt.co.uk/wp-content/themes/client/dist/audio/docbrown.mp3" + preload="auto"></audio> + <img class="docbrown" src="https://jigowatt.co.uk/wp-content/themes/client/dist/img/docbrown.png" alt="doc"> + + <!-- Biff --> + <audio class="biff" src="https://jigowatt.co.uk/wp-content/themes/client/dist/audio/biff.mp3" preload="auto"></audio> + <img class="biff" src="https://jigowatt.co.uk/wp-content/themes/client/dist/img/biff.png" alt="biff"> + + <!-- Goldie --> + <audio class="goldie" src="https://jigowatt.co.uk/wp-content/themes/client/dist/audio/goldie.mp3" + preload="auto"></audio> + <img class="goldie" src="https://jigowatt.co.uk/wp-content/themes/client/dist/img/goldie.png" alt="goldie"> + </div> + + <!-- Background Music + // CREDITS: // + + Title: The Classics - A New Retro Synthwave Mix + + Uploader: Confused Bi-Product of a Misinformed Culture + + Full Credits: https://cyne.cf/konami/assets/audio/midi.mp3.txt + --> + <audio src="/konami/assets/audio/midi.mp3" autoplay id="music"> + <p>If you are reading this, it is because your browser does not support the audio element.</p> + <script> + var audio = document.getElementById("music"); + audio.volume = 0.1; // Volume Adjuster, might bind it to "- and +" one day if possible. + </script> + </audio> + + </body> + +</html>
\ No newline at end of file diff --git a/konami/css/main.css b/konami/css/main.css new file mode 100644 index 0000000..3826e15 --- /dev/null +++ b/konami/css/main.css @@ -0,0 +1,297 @@ +/* BACKGROUND SPARKLES CSS */ + +html, body { + margin: 0 0; + padding: 0 0; + text-align: center; + font-size: 0; + background: url(../assets/bg/bg.gif); + cursor: url(../assets/images/smiley\ face\ cursor.cur), default; + overflow-X: hidden; /* Toasty */ +} + +/* ORINGINAL SITE CSS */ +html { + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; +} + +*, +*:before, +*:after { + -webkit-box-sizing: inherit; + box-sizing: inherit; +} + +html, body { + height: 100%; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row wrap; + flex-flow: row wrap; +} + +body { + font: normal 20px/1.4 'Inter', sans-serif; + margin: 0 1em; + padding: 1em 0; + color: red; + background: none; +} + +main { + font-size: 6vh; + line-height: 1.2; + max-width: 75vh; +} + +@media(max-width: 768px) { + main { + margin: auto; + width: 100%; + } +} + +.links a { + background-color: yellow; +} + +.email a:hover, +.email a:focus { + background: url(../assets/images/Email2.gif); + color: #fff; +} + +.twitter a:hover, +.twitter a:focus { + background: url(../assets/images/bullet.png); + color: #fff; +} + +.github a:hover, +.github a:focus { + background: url(../assets/images/geoshape.gif); + color: #fff; +} + +/* NAVIGATION MENU */ +.navigation-bar { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 1; + -ms-flex: 1 0 100%; + flex: 1 0 100%; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; +} + +@media(max-width: 768px) { + .navigation-bar { + display: none; + } +} + +.nav { + overflow: hidden; + max-width: 100%; + background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); + padding: 0 20px; + position: absolute; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.nav-item { + color: none; + padding: 20px; + margin: 0 6px; + font-weight: 500; + position: relative; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.nav-item:before { + content: ""; + position: absolute; + bottom: -6px; + left: 0; + width: 100%; + height: 70px; + background: url(../assets/images/cd-rom.gif); + opacity: 0; +} + +.nav-item:not(.is-active):hover:before { + opacity: 1; + bottom: 0; +} + +/* TOASTY */ + +.toasty { + position: absolute; + left: 110%; + bottom: 0; +} + +.flash { + animation: flash 1s linear infinite; +} + +.animateIn { + animation: 2s left forwards ease; +} + +.code { + text-align: center; + opacity: 0; + position: absolute; + top: calc(50% + 40px); + left: 50%; + transform: translate(-50%); + font-family: 'Open Sans Condensed', sans-serif; + font-size: 20px; + letter-spacing: 0.05em; + text-transform: uppercase; + border-bottom: 2px solid #333; + padding: 0 20px; + animation: fade 2.5s 7s forwards linear; +} + +@keyframes fade { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } +} + +@keyframes left { + 0% { + left: 110%; + } + + 50% { + left: 80%; + } + + 100% { + left: 110%; + } +} + +@keyframes flash { + 0% { + border-right: none; + } + + 100% { + border-right: 0.08em solid #222; + } +} + +/* BIFF, MARTY, EMMETT, GOLDIE */ +.eggsfound { + background: red; + color: white; + font-weight: bold; + opacity: 0; + left: 50%; + position: fixed; + top: 0; + width: 300px; + margin-left: -150px; + z-index: -300; + transition: opacity 0.5s ease; + padding: 10px; + text-align: center; +} + +.eggsfound.animate { + opacity: 1; + z-index: 999; +} + +img.marty, +img.docbrown, +img.biff, +img.goldie { + bottom: -376px; + position: fixed; + right: 0; + transition: bottom 0.3s ease; + z-index: 9999; +} + +.marty-show img.marty, +.docbrown-show img.docbrown, +.biff-show img.biff, +.goldie-show img.goldie { + bottom: 0; +} + +p { + text-align: center; + font-weight: bold; + margin: 50vh 0 0 0; + font-family: sans-serif; +} + +@media(max-width: 768px) { + .ee { + display: none; + } +} + +/* To remove background sparkles on CSS switch. */ +svg { + display: none; +} + +/* CLAIRO */ +.clairo { + position: absolute; + top: 5px; + left: 5px; +} + +/* Mobile Spacing */ +@media(max-width: 411px) { + main { + margin: auto; + width: 76.21%; + } +}
\ No newline at end of file diff --git a/konami/index.html b/konami/index.html new file mode 100644 index 0000000..3e8013a --- /dev/null +++ b/konami/index.html @@ -0,0 +1,120 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <title>s1nical - Konami</title> + <!-- Site metadata --> + <meta name="description" content="Konami Archive Bypass"> + <meta property="og:description" content="Konami Archive Bypass"> + <meta property="og:title" content="s1nical - Konami"> + <meta property="twitter:card" content="summary"> + <meta property="twitter:site" content="@9inny"> + <meta property="og:image" content=""> + <meta property="og:url" content="https://cyne.cf/konami"> + <link rel="apple-touch-icon" sizes="128x128" href="/favicon.jpg"> + <link rel="icon" type="image/jpg" href="/favicon.jpg" sizes="128x128"> + <link rel="canonical" href="https://cyne.cf/konami"> + <link rel="author" href="humans.txt" /> + <!-- Schema.org Stuff --> + <script type="application/ld+json"> + { + "name": "s1nical", + "alternateName": "s1n", + "description": "Konami Archive Bypass", + "headline": "Konami Archive Bypass", + "url": "https://cyne.cf/konami", + "image": "", + "sameAs": [ + "https://twitter.com/9inny", + "https://github.com/8cy", + "https://www.reddit.com/user/s1nical/" + ], + "publisher": { + "@type": "Organization", + "logo": { + "@type": "ImageObject", + "url": "" + } + }, + "@type": "WebSite", + "@context": "http://schema.org" + } + </script> + <link rel="shortcut icon" href="/favicon.jpg" type="image/jpg"> + <!-- External Links --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/0.3.1/trianglify.min.js"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> + <script src="https://code.jquery.com/jquery-1.10.2.js"></script> + <!-- CSS Links --> + <link rel="stylesheet" href="/about/css/main.css"> + <link rel="stylesheet" href="/about/css/navigation-bar.css"> + <link rel="stylesheet" href="/about/css/loader-animation.css"> + <link rel="stylesheet" href="/about/css/blog-slider.css"> + <link rel="stylesheet" href="/404/css/main.css"> + <!-- Invisible Scripts --> + <script src="/js/loader-animation.js"></script> + <script src="/js/refresh-on-media.js"></script> +</head> + + <body> + <!-- Visable Scripts --> + <script src="/js/background-sparkles.js"></script> + + <!-- Navigation Bar --> + <div class="navigation-bar"> + <nav class="nav"> + <a href="/home/" class="nav-item" active-color="orange">Home</a> + <!-- Had `is-active` after it but removed it due to not highlighting. --> + <a href="/about/" class="nav-item" active-color="green">About</a> <!-- About --> + <!--<a href="https://p.s1n.pw/" class="nav-item" active-color="blue">Portfolio</a> <!-- Testimonials --> + <a href="https://cyne.cf/status" class="nav-item" active-color="red">Status</a> <!-- Blog --> + <!--<a href="/cars/" class="nav-item" active-color="rebeccapurple">Cars</a> <!-- Contact --> + <!--<a href="https://nani.s1n.pw" class="nav-item" active-color="rebeccapurple">Nani?!</a>--> + <span class="nav-indicator"></span> + </nav> + </div> + + <div class="bio"> + <div class="links"> + <div class="blog-slider"> + <div class="content" style="text-align: center;"> + <h1>Are you sure?</h1> + <h2>You are entering a depreciated zone.</h2> + <h1> + <!-- Filler --> + </h1> + <a href="/konami/bypass/">Continue</a> + <h1> + <!-- Filler --> + </h1> + </div> + </div> + </div> + </div> + + <!-- Loading Animation --> + <div class="loader-wrapper"> + <div class="loader"> + <row> + <span></span> + <span></span> + <span></span> + </row> + <row> + <span></span> + <span></span> + <span></span> + </row> + <row> + <span></span> + <span></span> + <span></span> + </row> + </div> + </div> + </body> + +</html> diff --git a/konami/js/main.js b/konami/js/main.js new file mode 100644 index 0000000..2933594 --- /dev/null +++ b/konami/js/main.js @@ -0,0 +1,220 @@ +// LOADER ANIMATION +$(window).on("load", function () { + console.log("UP, UP, DOWN, DOWN, LEFT, RIGHT, LEFT, RIGHT, B, A") + console.log("Biff, Marty, Emmett, Goldie") + console.log("pie, ufo, walk, cool, balloon, hangover, kirby, no, onmyway, haters, board, snorlax, fly, earth, thankyou, swim, penguin, handsome, tank, jump, winner, fox, mario, joker, rabbit, piggy, psyduck, dragon, salamander, airguitar, pikachu, bravo, ghost, britney, pikarun, catrun, koggy, sonic, doggy, spongebob, gun, money, bird, piqiu, lol, ohhh, nyancat") +}) + +// SCROLLING TITLE +var space = " "; +var speed = "60"; +var pos = 0; +var msg = "// s1n.ical // Landing Page "; + +function Scroll() { + document.title = msg.substring(pos, msg.length) + space + msg.substring(0, pos); + pos++; + if (pos > msg.length) pos = 0; + window.setTimeout("Scroll()", speed); +} +Scroll(); + +// KONAMI CODE FOR TOASTY + +// a key map of allowed keys +var allowedKeys = { + 37: 'left', + 38: 'up', + 39: 'right', + 40: 'down', + 65: 'a', + 66: 'b' +}; + +// the 'official' Konami Code sequence +var konamiCode = ['up', 'up', 'down', 'down', 'left', 'right', 'left', 'right', 'b', 'a']; + +// a variable to remember the 'position' the user has reached so far. +var konamiCodePosition = 0; + +// add keydown event listener +document.addEventListener('keydown', function (e) { + // get the value of the key code from the key map + var key = allowedKeys[e.keyCode]; + // get the value of the required key from the konami code + var requiredKey = konamiCode[konamiCodePosition]; + + // compare the key with the required key + if (key == requiredKey) { + + // move to the next key in the konami code sequence + konamiCodePosition++; + + // if the last key is reached, activate cheats + if (konamiCodePosition == konamiCode.length) { + activateCheats(); + konamiCodePosition = 0; + } + } else { + konamiCodePosition = 0; + } +}); + +function activateCheats() { + + var audio = new Audio('https://s3-eu-west-1.amazonaws.com/wdildnproject2/toasty.mp3'); + audio.play(); + + $('.toasty').addClass('animateIn'); + setTimeout(function () { + $('.toasty').removeClass('animateIn'); + }, 3500); +} + +var TxtRotate = function (el, toRotate, period) { + this.toRotate = toRotate; + this.el = el; + this.loopNum = 0; + this.period = parseInt(period, 10) || 2000; + this.txt = ''; + this.tick(); + this.isDeleting = false; +}; + +TxtRotate.prototype.tick = function () { + var i = this.loopNum % this.toRotate.length; + var fullTxt = this.toRotate[i]; + + if (this.isDeleting) { + this.txt = fullTxt.substring(0, this.txt.length - 1); + } else { + this.txt = fullTxt.substring(0, this.txt.length + 1); + } + + this.el.innerHTML = '<span class="wrap">' + this.txt + '</span>'; + + var that = this; + var delta = 300 - Math.random() * 100; + + + setTimeout(function () { + that.tick(); + }, delta); +}; + +window.onload = function () { + var elements = document.getElementsByClassName('txt-rotate'); + for (var i = 0; i < elements.length; i++) { + var toRotate = elements[i].getAttribute('data-rotate'); + var period = elements[i].getAttribute('data-period'); + if (toRotate) { + new TxtRotate(elements[i], JSON.parse(toRotate), period); + } + } +}; + +// BIFF, MARTY, EMMETT, GOLDIE + +// give $ to jQuery +(function ($) { + + /**============================================================== + * BTTF CHARACTER EASTER EGGS + * ============================================================== + */ + var characters = {}; + var pressedKeys = []; + + /** + * Plays the audio clip for a specific easter egg character + * @param {string} character name of character + */ + function playAudio(character) { + setTimeout(function () { + characters[character].audioFile.play(); + setTimeout(function () { + toggleShowChar(character); + updateEggs(); + }, characters[character].audioLength); + }, 300); + } + + /** + * Toggles the display of an easter egg character + * @param {string} character character name + */ + function toggleShowChar(character) { + $('body').toggleClass(characters[character].name + '-show'); + } + + /** + * Add characters' information once page loads + */ + $(document).ready(function () { + characters = { + 'guessed': [], + 'marty': { + 'name': 'marty', + 'nameKeys': "77,65,82,84,89", + 'audioFile': $('audio.marty')[0], + 'audioLength': 1300, + }, + 'docbrown': { + 'name': 'docbrown', + 'nameKeys': "69,77,77,69,84,84", + 'audioFile': $('audio.docbrown')[0], + 'audioLength': 2500, + }, + 'biff': { + 'name': 'biff', + 'nameKeys': "66,73,70,70", + 'audioFile': $('audio.biff')[0], + 'audioLength': 1100, + }, + 'goldie': { + 'name': 'goldie', + 'nameKeys': "71,79,76,68,73,69", + 'audioFile': $('audio.goldie')[0], + 'audioLength': 4000, + }, + 'toasty': { + 'name': 'toasty', + 'nameKeys': "84,79,65,83,84,89", + } + }; + }); + + /** + * Track character names being typed + */ + $(window).keydown(function (e) { + + pressedKeys.push(e.keyCode); + + // loop through characters + for (var character in characters) { + + // if the "pressedKeys" contains the current character name + if (pressedKeys.toString().indexOf(characters[character].nameKeys) >= 0) { + + // reset the pressedKeys array + pressedKeys = []; + + // add "show" class to animate the character in + toggleShowChar(character); + + if ($.inArray(character, characters.guessed) === -1) { + characters.guessed.push(character); + } + + // wait a second and play the character's audio file + playAudio(character); + } + } + + // reset pressedKeys at 50 keypresses to save memory + if (pressedKeys.length > 500) { pressedKeys = []; } + + }); + +})(jQuery);
\ No newline at end of file |