My April Fools Day Prank

Back to Listing

My April Fools Day Prank


01 Apr, 2010


Slipped this into my application sometime last week. Wonder when my users will notice.

$(document).keyup(function() {
    if(itIsAprilFoolsDay())
        $("#strobie").css("background-color", getRandomColor());
});

function getRandomColor() {  
    var random = Math.round(0xffffff * Math.random());
    return ('#0' + random.toString(16)).replace(/^#0([0-9a-f]{6})$/i, '#$1');
}

function itIsAprilFoolsDay() {  
    var today = new Date();
    return today.getMonth() == 3 && today.getDate() == 1;
}
Share this story

Bobby Johnson

About Author

I am a passionate engineer with an interest in shipping quality software, building strong collaborative teams and continuous improvement of my skills, team and the product.

comments powered by Disqus
Back to top