Tuesday, July 29, 2014

Make a joke to your colleague

Basically I like to have fun and be funny in every possible way, expecially be fun through code.
As follows a joke you can make to a colleague who goes away from his desktop and leave the pc unlocked.

If your colleague was working with a browser you can leave him any kind of javascript joke, an alert, a confirm...
You can inject it through dev-console (F12) or url address bar typing for example javascript:confirm('Format your Hard Drive?').

But you can think about something more annoying...
Why don't you alterate the site he's currently browsing?

At instance you can make a button or every button unclickable... in this way!
$("input[type='button']").on("mouseover", function () {
    var obj = $(this),
    left = Math.floor(Math.random() * 600),
    top = Math.floor(Math.random() * 400);
    obj.css("position", "absolute");
    obj.css("left", left + "px");
    obj.css("top", top + "px");
As you can see, this script needs jQuery but you can easily write in plain javascript.

When your mouse is over the selected button, it moves randomly so you cannot click it :)

Very annoing, isn't?

You can also try it here: http://jsfiddle.net/QqanL

Have a funny day ;)

No comments:

Post a Comment