doodah/web/doodah.js
// Function called every "UPDATE" milliseconds

Function called every "UPDATE" milliseconds
Function called every " UPDATE " milliseconds
Update(now){
        console.log( "UPDATING SKIN: "+this.name );
        this.dom.style.left = this.xpos+"px";
		this.dom.style.top = this.ypos+"px";
        console.log( "> Updating measures...");
        for( var measure_name in this.measures ){
            var measure = this.measures[measure_name];
            if( measure.next_update<now ) measure.Update( now );
        }
        console.log( "> Updating meters...");
        for( var meter_name in this.meters ){
            var meter = this.meters[meter_name];
            console.log( "  Meter: "+meter_name );
            meter.update( 0 );
        }
        console.log( "> finished update");
        if( this.config.dynamicwindowsize==1 ) {
            console.log( "  ! Dynamic sizing configured" );
            this.width = 0;
            this.height = 0;
            for( var meter_name in this.meters ){
                var meter = this.meters[meter_name]
                this.width = Math.max( this.width, meter.xpos+meter.width );
                this.height = Math.max( this.height, meter.ypos+meter.height );
                console.log( "    METER: "+meter_name+": X="+meter.xpos+", Y="+meter.ypos+", W="+meter.width+", H="+meter.height );
            }
        }
        this.dom.style.width = this.width+"px";
        this.dom.style.height = this.height+"px";            
        /*
        // Skin resize to fit meters?
        if( this.config.dynamicwindowsize==1 ) {
            console.log( "  ! Dynamic sizing configured" );
            this.width = 0;
            this.height = 0;
            for( var meter_name in this.meters ){
                var meter = this.meters[meter_name]
                this.width = Math.max( this.width, meter.xpos+meter.width );
                this.height = Math.max( this.height, meter.ypos+meter.height );
                console.log( "    METER: "+meter_name+": X="+meter.xpos+", Y="+meter.ypos+", W="+meter.width+", H="+meter.height );
            }
            this.dom.style.width = this.width+"px";
            this.dom.style.height = this.height+"px";
        } else {
            this.width = this.config.skinwidth;
            this.height = this.config.skinheight;
        }
        */
        console.log( "  SKIN SIZE: X="+this.xpos+", Y="+this.ypos+", W="+this.width+", H="+this.height );
        this.next_update = now+this.config.update;
        console.log( "  Next Update at: "+this.next_update );
    }
Update ( now ) { console . log ( "UPDATING SKIN: " + this . name ) ; this . dom . style . left = this . xpos + "px" ; this . dom . style . top = this . ypos + "px" ; console . log ( "> Updating measures..." ) ; for ( var measure_name in this . measures ) { var measure = this . measures [ measure_name ] ; if ( measure . next_update < now ) measure . Update ( now ) ; } console . log ( "> Updating meters..." ) ; for ( var meter_name in this . meters ) { var meter = this . meters [ meter_name ] ; console . log ( "  Meter: " + meter_name ) ; meter . update ( 0 ) ; } console . log ( "> finished update" ) ; if ( this . config . dynamicwindowsize == 1 ) { console . log ( "  ! Dynamic sizing configured" ) ; this . width = 0 ; this . height = 0 ; for ( var meter_name in this . meters ) { var meter = this . meters [ meter_name ] this . width = Math . max ( this . width , meter . xpos + meter . width ) ; this . height = Math . max ( this . height , meter . ypos + meter . height ) ; console . log ( "    METER: " + meter_name + ": X=" + meter . xpos + ", Y=" + meter . ypos + ", W=" + meter . width + ", H=" + meter . height ) ; } } this . dom . style . width = this . width + "px" ; this . dom . style . height = this . height + "px" ; console . log ( "  SKIN SIZE: X=" + this . xpos + ", Y=" + this . ypos + ", W=" + this . width + ", H=" + this . height ) ; this . next_update = now + this . config . update ; console . log ( "  Next Update at: " + this . next_update ) ; }
Function called every "UPDATE" milliseconds
Function called every " UPDATE " milliseconds
// Reposition the skin at either its defined position or 
 // Below the previous skin
 /*
        if( Previous_Skin===undefined ) {
            this.xpos = ( (this.config.windowx==-1) ? 0 : this.config.windowx );
            this.ypos = ( (this.config.windowy==-1) ? 0 : this.config.windowy );
        } else {
            this.xpos = ( (this.config.windowx==-1) ? Previous_Skin.xpos : this.config.windowx );
            this.ypos = ( (this.config.windowy==-1) ? Previous_Skin.ypos+Previous_Skin.height : this.config.windowy );
        }
        */ // Update all Measures
 //console.log( "  Measure "+JSON.stringify( meter));
 // Update all Meters
 //if( meter.next_update<now ) 
 /*
        // If DOM has no fixed abode, position it next to the last skin.
        if( this.config.windowx==-1 ) {
            if( Previous_Skin===undefined) {
                this.xpos = 0;
            } else {
                this.xpos = Previous_Skin.config.windowx;
            }
        }
        if( this.config.windowy==-1 ) {
            console.log( "ADJUSTING Y POSITION" );
            if( Previous_Skin===undefined) {
                console.log( "  Previous_Skin is undefined");
                this.ypos = 0;
            } else {
                console.log( "  Previous skin is "+Previous_Skin.name+", "+ Previous_Skin.height);
                this.ypos = Previous_Skin.config.windowy + Previous_Skin.height;
            }
        }
        */ // Resize dynamic skins
 // Calculate size of skin based on meters
 //console.log( "    "+meter_name );
 // Update DOM size
 //} else {
 // Skin has a static size, but if smaller than 4x4 then we will reset it to 50x50
 //this.height = this.config.skinheight;
 //this.width = this.config.skinwidth;
 //if( this.height <5 ) this.height = 50;
 //if( this.width <5 _ this.width = 50;
 // Update DOM size
 /*
        // Skin resize to fit meters?
        if( this.config.dynamicwindowsize==1 ) {
            console.log( "  ! Dynamic sizing configured" );
            // Calculate size of skin based on meters
            this.width = 0;
            this.height = 0;
            for( var meter_name in this.meters ){
                //console.log( "    "+meter_name );
                var meter = this.meters[meter_name]
                this.width = Math.max( this.width, meter.xpos+meter.width );
                this.height = Math.max( this.height, meter.ypos+meter.height );
                console.log( "    METER: "+meter_name+": X="+meter.xpos+", Y="+meter.ypos+", W="+meter.width+", H="+meter.height );
            }
            // Update DOM size
            this.dom.style.width = this.width+"px";
            this.dom.style.height = this.height+"px";
        } else {
            this.width = this.config.skinwidth;
            this.height = this.config.skinheight;
        }
        */ // 
 //showcard( this.name, this );
 // Next update
