(function($){ CUWait = { //init_delay:0,//(debug) init_delay:1000, cnt : 0, panel : null, timer_id : null, dice_id : 0, rand : function( min, max ) { return Math.floor((Math.random() * max) + min); }, randColor : function() { var px = ["00","33","66","99","FF"]; return "#" + px[this.rand(0,px.length)] + px[this.rand(0,px.length)] + px[this.rand(0,px.length)]; }, createInner : function() { var nx = 2; var ny = 2; var dx = 20; var dy = 20; var w = 20-2; var h = 20-2; this.dice = []; for ( var y = 0; y < ny; y++ ) { for ( var x = 0; x < nx; x++ ) { this.dice.push( $("
") .css({ position:"absolute", left:(x*dx)+"px", top:(y*dy)+"px", width:w+"px", height:h+"px" }) .appendTo(this.panel) ); } } }, animateInner : function() { if ( this.dice_id >= this.dice.length ) { this.dice_id = 0; } var die = this.dice[this.dice_id]; this.dice_id++; die.css({ "background-color":this.randColor() }); }, create : function(e) { if ( this.cnt == 0 ) { return; } var z = 10000; var w = 40; var h = 40; var left = (e.pageX - w/2); var top = (e.pageY - h/2); //-- panel this.panel = $("
") .css({ position:"absolute", left:left+"px", top:top+"px", width:"40px", height:"40px", margin:0, padding:0, opacity:0, filter:"alpha(opacity=0)", "z-index":z }) .appendTo('body'); //-- panel inner this.createInner(); //-- show this.panel.show(); //-- make it visible after init_delay var _this = this; setTimeout(function(){ _this.visible(); },this.init_delay); }, visible : function() { if ( this.cnt == 0 ) { return; } //-- panel this.panel .css({ opacity:0.5, filter:"alpha(opacity=50)" }); //-- panel inner var _this = this; this.timer_id = setInterval(function(){ _this.animateInner(); },50); }, destroy : function() { if ( this.panel == null ) { return; } //-- panel inner if ( this.timer_id != null ) { clearInterval(this.timer_id); this.timer_id = null; } //-- panel this.panel.fadeOut(function(){ $(this).remove(); }); this.panel = null; }, start : function( e ) { this.cnt++; if ( this.cnt == 1 ) { this.create( e ); } }, stop : function() { if ( this.cnt > 0 ) { this.cnt--; if ( this.cnt == 0 ) { this.destroy(); } } } }; //---------------------------------------------------------------- // CApp //---------------------------------------------------------------- var app_object_selector = '