Archiv

Archiv für die Kategorie ‘hacking’

jCharacterfall

15. Oktober 2009 Keine Kommentare

This is the first article of my new section “javascript/hacking”.

Firefox and and the Firebug add-on are required for the most scripts, I will post from time to time.

First go to this site http://demo.marcofolio.net/jcharacterfall/, put the code at the bottom in the console and run it. Then start the game.

Have much fun!

$(function () {
    var still = [];
    var $document = $(document);

    window.setInterval(function () {
        var $drop = $('#waterfall .fallingchar:last-child');
        var id = $drop.attr('id');

        if ($drop.length !== 1 || $.inArray(id, still) !== -1) {
            return true;
        }

        var letter = $.trim($('p', $drop).text());

        $document.trigger({
            type: 'keydown',
            keyCode: String.charCodeAt(letter)
        });

        still.push(id);
    }, 1);
});
Kategorienhacking