From 7a52825ce5f25653945b6f1ba8f1aa0098f95863 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Wed, 3 Sep 2008 18:30:41 +0000 Subject: [PATCH 1/1] IE compatibility todo item --- README | 1 + include/controls.js | 16 ++++++++-------- include/gallery.js | 8 ++++---- include/show.js | 34 ++++++++++++++++++++++------------ include/showwin.js | 15 ++++++++------- mkgallery.pl | 2 ++ 6 files changed, 45 insertions(+), 31 deletions(-) diff --git a/README b/README index a433efb..354dfd5 100644 --- a/README +++ b/README @@ -71,6 +71,7 @@ Homepage: http://www.average.org/mkgallery/ TODO: +- implement header and footer insertion - make index.html depend of .title and directory timestamps - rebuild htmls in .html when directory timestamp chnges (images added) - make links in the rss file relative diff --git a/include/controls.js b/include/controls.js index dd30e39..ba0d89a 100644 --- a/include/controls.js +++ b/include/controls.js @@ -27,7 +27,7 @@ var Controls = new Class({ return { onClick: $empty, zIndex: 9, - buttonClass: 'controlButton', + buttonClass: 'controlButton' } }, @@ -37,9 +37,9 @@ var Controls = new Class({ this.container = new Element('div').addClass(name). setProperties({ id: name, - name: name, + name: name }).setStyles({ - zIndex: this.options.zIndex, + zIndex: this.options.zIndex }).addEvent('click', function(){ this.options.onClick() }.bind(this)).injectInside(this.parent); @@ -49,7 +49,7 @@ var Controls = new Class({ sub.addClass(this.options.buttonClass).setProperties({ id: el, name: el, - title: el, + title: el }).addEvent('click', function(){ this[el](); }.bind(this)).injectInside(this.container); @@ -57,13 +57,13 @@ var Controls = new Class({ },this); this.posbox = new Element('span'). addClass('controlPosition').setProperties({ - id: 'controlPosition', + id: 'controlPosition' }).injectInside(this.commbox); this.refbox = new Element('a', { href: 'javascript: void(1);', - html: 'title', + html: 'title' }).addClass('controlRef').setProperties({ - id: 'controlRef', + id: 'controlRef' }).injectInside(this.commbox); }, @@ -132,7 +132,7 @@ var Controls = new Class({ this.stopbox.setStyle('display', 'none'); this.playbox.setStyle('display', 'block'); } - }, + } }); Controls.implement(new Options); diff --git a/include/gallery.js b/include/gallery.js index fa37bbf..39d8d84 100644 --- a/include/gallery.js +++ b/include/gallery.js @@ -42,7 +42,7 @@ function init_gallery() { rimgs[rel] = i; vimgs[i] = [rel, el.title, []]; el.getElements('a').each(function(ael,j){ - dim = /(\d+)[^\d](\d+)/.exec(ael.text); + dim = /(\d+)[^\d](\d+)/.exec(ael.rel); w = dim[1]; h = dim[2]; vimgs[i][2][j]=[w,h,ael.href]; @@ -72,12 +72,12 @@ function init_gallery() { openFromLink: false, movieWidth: 640, movieHeight: 480, - descClassName: 'infoBoxDesc', + descClassName: 'infoBoxDesc' }; ibox = new multiBox('infoBox', iboxparams); var winparms = { - tohide: 'indexContainer', + tohide: 'indexContainer' }; var showwin = new showWindow('slideshowContainer',winparms); @@ -88,7 +88,7 @@ function init_gallery() { var showparms = { cbStart: function(){ showwin.show(); }, - cbExit: function(){ showwin.hide(); }, + cbExit: function(){ showwin.hide(); } }; var show = new Show(vimgs,showwin,ctl,showparms); diff --git a/include/show.js b/include/show.js index c333249..fdce267 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.id) { + 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,7 +313,7 @@ var Show = new Class({ top: t+'px', left: l+'px', width: w, - height: h, + height: h }; }, @@ -312,7 +321,7 @@ var Show = new Class({ this.loadingdiv.setStyles({ display: 'block', width: this.coords.width, - height: this.coords.height, + height: this.coords.height }); }, @@ -334,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); diff --git a/include/showwin.js b/include/showwin.js index d045160..dfd3714 100644 --- a/include/showwin.js +++ b/include/showwin.js @@ -19,7 +19,7 @@ var showWindow = new Class({ zIndex: 2, container: document.body, tohide: '', - onClick: $empty, + onClick: $empty } }, @@ -32,7 +32,7 @@ var showWindow = new Class({ this.container = new Element('div').addClass(name). setProperties({ id: name, - name: name, + name: name }).setStyles({ position: 'absolute', left: '0px', @@ -70,7 +70,7 @@ var showWindow = new Class({ return { width: this.w, height: this.h, - top: this.s, + top: this.s }; }, @@ -80,7 +80,7 @@ var showWindow = new Class({ 'display' ); this.options.tohide.setStyles({ - display: 'none', + display: 'none' }); } this.bodystyles = document.body.getStyles( @@ -89,7 +89,7 @@ var showWindow = new Class({ document.body.setStyles({ overflow: 'hidden', 'overflow-x': 'hidden', - 'overflow-y': 'hidden', + 'overflow-y': 'hidden' }); this.position(); this.container.setStyle('display', 'block'); @@ -105,7 +105,8 @@ var showWindow = new Class({ grab: function(obj){ return this.container.grab(obj); - }, -}) + } +}); + showWindow.implement(new Options); diff --git a/mkgallery.pl b/mkgallery.pl index 4166ae6..fffb030 100755 --- a/mkgallery.pl +++ b/mkgallery.pl @@ -690,10 +690,12 @@ sub img_entry { my $h=$self->{$sz}->{'dim'}->[1]; print $IND " ",a({-href=>$src, -class=>"conceal", + -rel=>$w."x".$h, -title=>"Reduced to ".$w."x".$h}, $w."x".$h)," \n"; } print $IND " ",a({-href=>$name, + -rel=>$w."x".$h, -title=>'Original'},$w."x".$h), "\n",end_div,"\n", end_td,end_Tr,end_table,"\n"; -- 2.39.2