/Ugly/ + 'JavaScript'

A place for ugly, silly, or just-plain-crap JavaScript.

A function for each cloud

Some poor Google employee had the job of making a maintenance page for the once-hyped Google Wave. Apparently, we need a function for each cloud, and each wave:

var cloudMoved = false;
var cloud2Moved = false;
var cloud3Moved = false;
var WAVE_TIME = 6000;

$(init);

function init()
{
    cloudMove();
    cloud2Move();
    cloud3Move();
    waves2Out();
    waves3Out();
}

function cloudMove()
{
    if (!cloudMoved) {
        $("#cloud").css("left", $("#cloud").offset().left)
    }
    
    $("#cloud").animate(
        //...
    )
}

function cloud2Move()
{
    if (!cloud2Moved) {
        $("#cloud2")
            .css("left", $("#cloud2").offset().left)
    }
    
    $("#cloud2").animate(
        //...
    )
}

function cloud3Move() //... etc.
Posted by James on 09 Sep 2011 | linky

Subscribe or follow @UglyJS!
.........
Fork then send a pull request to contribute.