Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 638361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:43:28+00:00 2026-05-13T20:43:28+00:00

I have created a rudimentary EasterEgg within my code to activate when the following

  • 0

I have created a rudimentary EasterEgg within my code to activate when the following keystrokes are made (not simultaneously) Enter + c + o + l + o + r + s with the following code:

isEnter = 0; isC = 0; isO = 0; isL = 0; isR = 0; isS = 0;
$(window).keydown(function(e){
    if(e.which==13) isEnter = 1; if(e.which==67) isC = 1; if(e.which==79) isO = 1; 
    if(e.which==76) isL = 1; if(e.which==82) isR = 1; if(e.which==83) isS = 1;
    ColorMap();
});

function ColorMap(){
  if(isEnter==1 && isC==1 && isO==1 && isL==1 && isR==1 && isS==1){
     //DO FUNCTION//
     isEnter = 0; isC = 0; isO = 0; isL = 0; isR = 0; isS = 0; //SET VARS BACK TO 0
  };
};

I need to add reset functionality to the keydown function to reset all variables if something other than those keys are pressed… that way they have to press Enter + c + o + l + o + r + s or the statement gets reset and they have to start again…(this will make the ‘EasterEgg’ harder to get to [or at least less likely to get to by fluke or random keystrokes]).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:43:28+00:00Added an answer on May 13, 2026 at 8:43 pm

    You want to check for these in order, as well. Right now, you could push the keys in any order and still activate the Easter Egg. Enter + lorocs for example.

    I’d store the values you are looking for in order, like this:

    //       Enter, c, o, l, o, r, s
    var keys = [13,67,79,76,79,82,83];
    

    Then, you can just keep track of where the user is in the sequence:

    var nextKey = 0;
    $(window).keydown(function(e){
        var key = e.which;
        if (key === keys[nextKey])
            nextKey++;
    
        ColorMap();
    });
    

    This will increment nextKey every time you match the next key that you are looking for in the sequence. The nextKey variable starts at the 0 index, which means we start looking for Enter. Now, we need to check for the end condition in the ColorMap function.

    function ColorMap() {
      var maxKeyIndex = keys.length - 1;
      if(nextKey >= maxKeyIndex) {
         //DO FUNCTION//
    
         nextKey = 0;
      }
    }
    

    This solution should allow you to change the special sequence in the keys variable without requiring a change elsewhere in the code.

    EDIT:
    If you want the answer to be contiguous, as you probably do, then you can reset the nextKey variable when the match fails.

    if (key === keys[nextKey])
        nextKey++;
    else
        nextKey = 0;
    

    For extra credit, you could switch this to use a string to hold the easter egg, then String.fromCharCode to convert it to the character code that e.which returns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As of right now, in my app I have created a rudimentary gallery app
I'm trying to code a very rudimentary GTD app for myself, not only to
Have created a c++ implementation of the Hough transform for detecting lines in images.
I have created a template for Visual Studio 2008 and it currently shows up
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a PHP-script to update a web server that is live inside
I have created a UserControl that has a ListView in it. The ListView is
I have created a C# class file by using a XSD-file as an input.
I have created a few small flash widgets that stream .mp3 audio from an
i have created a workflow activity that do give the item creater of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.