Created
May 19, 2015 02:56
-
-
Save stephenscaff/e715a0f7f9d28e35aade to your computer and use it in GitHub Desktop.
shhhhh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * ICM Easter Eggs © 2014 | |
| * Version 1.0 | |
| * Author: Joe Furfaro | |
| * | |
| */ | |
| $(function(){ | |
| $('body').on('submit.easterEgg', 'form', function(e){ | |
| var $form = $(this), | |
| $firstName = $form.find('input[name="first_name"]'), | |
| $lastName = $form.find('input[name="last_name"]'); | |
| if($firstName.length > 0 && $lastName.length > 0){ | |
| var fullName = $firstName.val().replace(/\s/g, '') + ' ' + $lastName.val().replace(/\s/g, ''); | |
| // Use a switch to simply add cases | |
| switch(fullName.toLowerCase()){ | |
| case 'carl brutananadilewski': | |
| e.preventDefault(); | |
| doTheCarl($firstName, $lastName); | |
| break; | |
| case 'veloci raptor': | |
| e.preventDefault(); | |
| cleverGirl($firstName, $lastName); | |
| break; | |
| case 'theking ofpop': | |
| e.preventDefault(); | |
| notMyLover($firstName, $lastName); | |
| break; | |
| case 'shiem edelbrock': | |
| e.preventDefault(); | |
| fuckinSweetFunciton($firstName, $lastName); | |
| break; | |
| case 'accessmain securitygrid': | |
| e.preventDefault(); | |
| sayTheMagicWord($firstName, $lastName); | |
| break; | |
| default: | |
| break; | |
| } | |
| } | |
| }); | |
| function doTheCarl($firstName, $lastName) { | |
| var $carl = $('<img src="/assets/shared/img/velociraptor/carl.png">'); | |
| $carl.css({ | |
| position: 'fixed', | |
| left: -346, | |
| bottom: 30, | |
| zIndex: 9999 | |
| }); | |
| $carl.appendTo('body').animate({left: 20}, 1500, function(){ | |
| setTimeout(function(){ | |
| $carl.animate({left: -346}, 1500, function(){ | |
| $carl.remove(); | |
| $firstName.val('').focus(); | |
| $lastName.val(''); | |
| }); | |
| }, 5000); | |
| }); | |
| } | |
| function cleverGirl($firstName, $lastName) { | |
| var $raptor = $('<img src="/assets/shared/img/velociraptor/velociraptor.png">'), | |
| $roar = $('<audio src="/assets/shared/img/velociraptor/raptor-sound.mp3" preload="auto">'); | |
| $raptor.css({ | |
| position: 'fixed', | |
| right: -400, | |
| bottom: 0, | |
| zIndex: 9999 | |
| }); | |
| $roar[0].play(); | |
| $raptor.appendTo('body').animate({right: '100%'}, 3000, function(){ | |
| $raptor.remove(); | |
| $firstName.val('').focus(); | |
| $lastName.val(''); | |
| }); | |
| } | |
| function notMyLover($firstName, $lastName) { | |
| var $michael = $('<img src="/assets/shared/img/velociraptor/michael.gif">'), | |
| $billie = $('<audio src="/assets/shared/img/velociraptor/billie-jean.mp3" preload="auto">'), | |
| wh = $(window).height(), | |
| ww = $(window).width(), | |
| laps = 0; | |
| $billie[0].play(); | |
| setTimeout(moonwalk, 2000); | |
| function moonwalk() { | |
| var speed = '3'; | |
| $michael.css({ | |
| position: 'fixed', | |
| right: 0, | |
| bottom: 0, | |
| zIndex: 9999, | |
| '-webkit-transform': 'rotate(0deg)', | |
| '-moz-transform': 'rotate(0deg)', | |
| 'transform': 'rotate(0deg)', | |
| '-webkit-transform-origin': 'left bottom', | |
| '-moz-transform-origin': 'left bottom', | |
| 'transform-origin': 'left bottom' | |
| }); | |
| if(laps == 0){ | |
| $michael.css({right: -44}).appendTo('body'); | |
| } | |
| goLeft(); | |
| function goLeft() { | |
| $michael.animate({right: '+=' + speed}, 1, 'linear', function(){ | |
| if(parseInt($michael.css('right')) < ww - 44){ | |
| goLeft(); | |
| }else{ | |
| $michael.css({ | |
| '-webkit-transform': 'rotate(90deg)', | |
| '-moz-transform': 'rotate(90deg)', | |
| 'transform': 'rotate(90deg)', | |
| bottom: 44 | |
| }); | |
| goUp(); | |
| } | |
| }); | |
| } | |
| function goUp() { | |
| $michael.animate({bottom: '+=' + speed}, 1, 'linear', function(){ | |
| if(parseInt($michael.css('bottom')) < wh){ | |
| goUp(); | |
| }else{ | |
| $michael.css({ | |
| '-webkit-transform': 'rotate(180deg)', | |
| '-moz-transform': 'rotate(180deg)', | |
| 'transform': 'rotate(180deg)', | |
| right: ww - 88 | |
| }); | |
| goRight(); | |
| } | |
| }); | |
| } | |
| function goRight() { | |
| $michael.animate({right: '-=' + speed}, 1, 'linear', function(){ | |
| if(parseInt($michael.css('right')) > 0){ | |
| goRight(); | |
| }else{ | |
| $michael.css({ | |
| '-webkit-transform': 'rotate(270deg)', | |
| '-moz-transform': 'rotate(270deg)', | |
| 'transform': 'rotate(270deg)', | |
| right: -44, | |
| bottom: wh - 44 | |
| }); | |
| goDown(); | |
| } | |
| }); | |
| } | |
| function goDown() { | |
| $michael.animate({bottom: '-=' + speed}, 1, 'linear', function(){ | |
| if(parseInt($michael.css('bottom')) > 0){ | |
| goDown(); | |
| }else{ | |
| laps++; | |
| if(laps < 2) { | |
| moonwalk(); | |
| }else{ | |
| $michael.remove(); | |
| $billie[0].pause(); | |
| $firstName.val('').focus(); | |
| $lastName.val(''); | |
| } | |
| } | |
| }); | |
| } | |
| } | |
| } | |
| function fuckinSweetFunciton($firstNaem, $lastNam) { | |
| var $shiemdog = $('<img src="/assets/shared/img/velociraptor/shiem.gif">'); | |
| $shiemdog.css({ | |
| position: 'fixed', | |
| right: 0, | |
| bottom: -453, | |
| zIndex: 9999 | |
| }); | |
| $shiemdog.appendTo('body').animate({bottom: 0}, 2000, function(){ | |
| setTimeout(function(){ | |
| $shiemdog.animate({bottom: -453}, 1500, function(){ | |
| $shiemdog.remove(); | |
| $('body').off('submit.easterEgg'); | |
| }); | |
| }, 1700); | |
| }); | |
| } | |
| function sayTheMagicWord($firstName, $lastName) { | |
| var $nedry = $('<img src="/assets/shared/img/velociraptor/nedry.gif">'), | |
| $console = $('<div>> </div>'), | |
| initCommand = 'access main security grid', | |
| initResponse = ['access: PERMISSION DENIED','....','and','....'], | |
| repeatResponse = 'YOU DIDN\'T SAY THE MAGIC WORD!<br>'; | |
| $console.css({ | |
| position: 'fixed', | |
| zIndex: 9998, | |
| padding: 20, | |
| background: '#193B9E', | |
| top: 0, | |
| left: 0, | |
| bottom: 0, | |
| right: 0, | |
| color: '#fff', | |
| font: '16px "Lucida Console", Monaco, monospace' | |
| }); | |
| $nedry.css({ | |
| position: 'fixed', | |
| right: 10, | |
| bottom: -248, | |
| zIndex: 9999 | |
| }); | |
| $console.appendTo('body'); | |
| setTimeout(typeIt, 400); | |
| var charIndex = 0, | |
| repeat = false; | |
| function typeIt() { | |
| $console.append(initCommand.charAt(charIndex++)); | |
| if(charIndex < initCommand.length){ | |
| setTimeout(typeIt, 90); | |
| }else{ | |
| $console.append('<br>'); | |
| setTimeout(function(){ | |
| $console.append(initResponse[0]); | |
| setTimeout(function(){ | |
| $console.append(initResponse[1]); | |
| setTimeout(function(){ | |
| $console.append(initResponse[2]) | |
| setTimeout(function(){ | |
| $console.append(initResponse[3] + '<br>'); | |
| repeat = true; | |
| setTimeout(doRepeat, 500); | |
| }, 300); | |
| }, 400); | |
| }, 400); | |
| }, 750); | |
| } | |
| } | |
| function doRepeat(){ | |
| $console.append(repeatResponse); | |
| if(repeat){ | |
| setTimeout(doRepeat, 650); | |
| }else{ | |
| return false; | |
| } | |
| } | |
| setTimeout(function(){ | |
| $nedry.appendTo('body').animate({bottom: 20}, 3000, function(){ | |
| setTimeout(function(){ | |
| $nedry.animate({bottom: -248}, 3000, function(){ | |
| $nedry.remove(); | |
| $console.remove(); | |
| repeat = false; | |
| $firstName.val('').focus(); | |
| $lastName.val(''); | |
| }); | |
| }, 15000); | |
| }); | |
| }, 5000); | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment