X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fshow.js;h=2d5f5b168255cd2bd0cfe0de0b11a9065d76da3a;hp=535c4217e40d772a27a6de91b5ec29ab15ffc026;hb=02e3f3fcb4c9f4741974ee40e838ed0b8a358b88;hpb=571fe3717a8c6905899034b813c4e7f4cacbf92a diff --git a/include/show.js b/include/show.js index 535c421..2d5f5b1 100644 --- a/include/show.js +++ b/include/show.js @@ -43,7 +43,7 @@ var Show = new Class({ cbExit: function(){ alert('show exit undefined'); }, percentage: 98, delay: 5000, - fxduration: 200, + fxduration: 200 } }, @@ -58,7 +58,7 @@ var Show = new Class({ this.cache = { prev: {}, curr: {}, - next: {}, + next: {} }; /* * thescripts.com/forum/thread170365.html @@ -84,7 +84,7 @@ var Show = new Class({ zIndex: 4, display: 'none', width: this.coords.width, - height: this.coords.height, + height: this.coords.height }); this.container.grab(this.loadingdiv); @@ -171,7 +171,7 @@ var Show = new Class({ var newcache = { prev: (id > 0)?this.prepare(id-1):{}, curr: this.prepare(id), - next: (id < (this.vimgs.length-1))?this.prepare(id+1):{}, + next: (id < (this.vimgs.length-1))?this.prepare(id+1):{} }; delete this.cache; this.cache = newcache; @@ -211,7 +211,7 @@ var Show = new Class({ id: id, vi: vi, ready: false, - url: this.vimgs[id][2][vi][2], + url: this.vimgs[id][2][vi][2] }; cachel.img = this.bgload(cachel); } @@ -224,7 +224,7 @@ var Show = new Class({ return new Asset.image(this.vimgs[cachel.id][2][cachel.vi][2],{ id: this.vimgs[cachel.id][0], title: this.vimgs[cachel.id][1], - onload: this.loadcomplete.bind(this,[cachel]), + onload: this.loadcomplete.bind(this,[cachel]) }); }, @@ -247,7 +247,7 @@ var Show = new Class({ setStyles(this.calcsize(cachel)). setStyles({ zIndex: 3, - opacity: 0, + opacity: 0 }); this.ondisplay.replaces(this.prevdisplay). setProperty('alt', 'Previous Image'). @@ -260,7 +260,7 @@ var Show = new Class({ effect: function(){ this.fx = new Fx.Tween(this.ondisplay, { - duration: this.options.fxduration, + duration: this.options.fxduration }); this.fx.addEvent('complete',this.displaycomplete.bind(this)); this.fx.start('opacity', 0, 1); @@ -284,6 +284,15 @@ var Show = new Class({ }, calcsize: function(cachel){ + if (! cachel.url) { + return { + position: 'absolute', + top: 0+'px', + left: 0+'px', + width: this.coords.width, + height: this.coords.height + }; + } var factor = 1; var candidate; candidate = this.target.width / @@ -304,12 +313,16 @@ var Show = new Class({ top: t+'px', left: l+'px', width: w, - height: h, + height: h }; }, showloading: function(){ - this.loadingdiv.setStyle('display', 'block'); + this.loadingdiv.setStyles({ + display: 'block', + width: this.coords.width, + height: this.coords.height + }); }, hideloading: function(){ @@ -330,13 +343,14 @@ var Show = new Class({ width: Math.round(this.coords.width * this.options.percentage / 100), height: Math.round(this.coords.height * - this.options.percentage / 100), + this.options.percentage / 100) }; /* alert('coords: '+this.coords.width+'x'+this.coords.height+ ', target: '+this.target.width+'x'+this.target.height); */ - }, + } }); + Show.implement(new Options); Show.implement(new Events);