zIndex: 2,
container: document.body,
onClick: $empty,
- };
+ }
},
initialize: function(div,options){
- this.setOptions(this.getOptions(), options);
+ this.setOptions(this.getOptions(), options)
- this.options.container = $(this.options.container);
+ this.options.container = $(this.options.container)
- this.div = $(div);
+ this.div = $(div)
this.div.setStyles({
position: 'absolute',
left: '0px',
zIndex: this.options.zIndex,
overflow: 'hidden',
display: 'none'
- });
+ })
this.div.addEvent('click', function(){
- this.options.onClick();
- }.bind(this));
+ this.options.onClick()
+ }.bind(this))
- this.position();
+ this.position()
- window.addEvent('resize', this.position.bind(this));
- window.addEvent('scroll', this.position.bind(this));
+ window.addEvent('resize', this.position.bind(this))
+ window.addEvent('scroll', this.position.bind(this))
},
position: function(){
if(this.options.container == document.body){
- var h = window.getHeight()+'px';
- var s = window.getScrollTop()+'px';
- this.div.setStyles({top: s, height: h});
+ var h = window.getHeight()+'px'
+ var s = window.getScrollTop()+'px'
+ this.div.setStyles({top: s, height: h})
}else{
- var myCoords = this.options.container.getCoordinates();
+ var myCoords = this.options.container.getCoordinates()
this.div.setStyles({
top: myCoords.top+'px',
height: myCoords.height+'px',
left: myCoords.left+'px',
width: myCoords.width+'px'
- });
+ })
}
},
show: function(){
- this.div.setStyles({display: 'block'});
+ this.div.setStyles({display: 'block'})
},
hide: function(){
- this.div.setStyles({display: 'none'});
+ this.div.setStyles({display: 'none'})
}
-});
-showWindow.implement(new Options);
+})
+showWindow.implement(new Options)
/* Make overlay window and start slideshow */
-function run_slideshow(startid) {
- showwin.show();
- show.stop();
- if (startid < 0) {
- show.play(0);
- } else {
- show.play(startid);
- show.stop();
+function showImage(id,doplay) {
+ var i=rimgs[id]
+ /* alert('show id='+id+' index='+i+' doplay='+doplay) */
+ showwin.show()
+ show.play(i)
+ if (!doplay) {
+ show.stop()
}
- return false;
+ return false
}
/* Stop slideshow and return to index page */
-function stop_slideshow() {
- show.stop();
- showwin.hide();
- return false;
+function showStop() {
+ show.stop()
+ showwin.hide()
+ /*
+ var img = show.newImage.getElement('img');
+ if(img) {
+ alert('remove element: '+img.get('tag')+'.'+img.get('class')+
+ '#'+img.get('id')+' src='+img.get('src'))
+ img.dispose()
+ }
+
+ img = show.oldImage.getElement('img');
+ if(img) {
+ alert('remove element: '+img.get('tag')+'.'+img.get('class')+
+ '#'+img.get('id')+' src='+img.get('src'))
+ img.dispose()
+ }
+
+ show.imagesHolder.getElements('img').each(function(el){
+ alert('remove element: '+el.get('tag')+'.'+el.get('class')+'#'+el.get('id')+
+ ' src='+el.get('src'))
+ el.dispose()
+ })
+ */
+ return false
}
/* List of lists of img variations. Each image variation is a three-element */
* ...
* ]
*/
+/* resolve string ID to index */
+var rimgs=[]
+
/* Initialize everything, to be called on domready */
function init_gallery() {
- $$('div.varimages').each(function(el){
+ $$('.conceal').each(function(el){
+ el.setStyle('display', 'none')
+ })
+ $$('a.infoBox').each(function(el){
+ var url=el.get('href')
+ el.set('href',url+'?conceal')
+ })
+ $$('a.showStart').each(function(el){
+ el.addEvent('click', showImage.bind(el,[el.get('id'),1]))
+ })
+ $$('a.showImage').each(function(el){
+ el.addEvent('click', showImage.bind(el,[el.get('id'),0]))
+ })
+ $$('div.varimages').each(function(el,i){
var id=el.id
- vimgs[id]=[]
- el.getElements('a').each(function(ael,i){
+ rimgs[id]=i
+ vimgs[i]=[]
+ el.getElements('a').each(function(ael,j){
dim = /(\d+)[^\d](\d+)/.exec(ael.text)
w = dim[1]
h = dim[2]
- vimgs[id][i]=[w,h,ael.href]
+ vimgs[i][j]=[w,h,ael.href]
})
})
/* debugging output
wait: 3000,
effect: 'fade',
duration: 1000,
- loop: true,
+ loop: false,
thumbnails: true,
onClick: function(i){alert(i)}
}
show = new slideShow('slideshowContainer','slideshowThumbnail',showparms)
parsedurl = parseUrl(document.URL)
- // alert('Anchor: '+parsedurl['anchor']+'\nURL: '+document.URL)
+ /* alert('Anchor: '+parsedurl['anchor']+'\nURL: '+document.URL) */
if ($chk(parsedurl['anchor'])){
- run_slideshow(parsedurl['anchor'])
+ showImage(parsedurl['anchor'],0)
}
}
$self->{$size}->{'dim'} = [$w, $h];
} else {
$self->{$size}->{'url'} = $nref;
- $self->{$size}->{'dim'} = [$w*$factor, $h*$factor];
+ $self->{$size}->{'dim'} = [int($w*$factor+.5),
+ int($h*$factor+.5)];
if (isnewer($fn,$nfn)) {
doscaling($fn,$nfn,$factor,$w,$h);
}
for my $refresh('static', 'slide') {
my $fn = sprintf("%s/.html/%s-%s.html",$dn,$name,$refresh);
if (isnewer($self->{-fullpath},$fn)) {
- my $imgsrc = '../'.$self->{$sizes[1]};
+ my $imgsrc = '../'.$self->{$sizes[1]}->{'url'};
my $fwdref;
my $bakref;
if ($nref) {
-style=>{-src=>$inc."gallery.css"},
),"\n";
}
- print $F start_center,"\n",
- h1($title),"\n",
- start_table({-class=>'navi'}),start_Tr,"\n",
+ print $F start_table({-class=>'navi'}),start_Tr,"\n",
td(a({-href=>"../index.html"},"Index")),"\n",
td(a({-href=>$bakref},"<<Prev")),"\n",
td(a({-href=>$toggleref},$toggletext)),"\n",
td(a({-href=>$fwdref},"Next>>")),"\n",
+ td({-class=>'title'},$title),"\n",
end_Tr,
end_table,"\n",
- table({-class=>'picframe'},
- Tr(td(img({-src=>$imgsrc})))),"\n",
- end_center,"\n",
+ center(table({-class=>'picframe'},
+ Tr(td(img({-src=>$imgsrc}))))),"\n",
end_html,"\n";
close($F);
}
my $first = $self->{-firstimg}->{-base};
my $slideref = sprintf(".html/%s-slide.html",$first);
- print $IND h2("Images"),"\n",
- a({-href=>$slideref,
- -onClick=>"return run_slideshow(-1);"},
- 'Slideshow'),
+ print $IND h2("Images ",
+ a({-href=>$slideref,-class=>'showStart',-id=>$first},
+ '> slideshow')),"\n",
start_div({-id=>"slideshowWindow",-class=>"slideshowWindow"}),
div({-id=>"slideshowContainer",
-class=>"slideshowContainer"},""),
"Stop"),
a({-href=>"#",-onClick=>"show.next();return false;"},
"Next"),
- a({-href=>"#",-onClick=>"stop_slideshow();return false;"},
+ a({-href=>"#",-onClick=>"showStop();return false;"},
"Exit"),
end_div,
end_div,
my $i=0+$self->{-parent}->{-numofimgs};
$self->{-parent}->{-numofimgs}++;
- print $IND a({-name=>$i}),"\n",
+ print $IND a({-name=>$name}),"\n",
start_table({-class=>'slide'}),start_Tr,start_td,"\n",
div({-class=>'slidetitle',-id=>$name},
- a({-href=>".html/$name-info.html?conceal",
+ "\n ",a({-href=>".html/$name-info.html",
-title=>'Image Info: '.$name,
-class=>'infoBox'},
- $title)),"\n",
+ $title),"\n"),"\n",
div({-class=>'slideimage',-id=>$name},
- a({-href=>".html/$name-static.html",-title=>$title,
- -id=>$name,
- -OnClick=>"return run_slideshow(".$i.");"},
- img({-src=>$thumb}))),"\n",
- start_div({-class=>'varimages',-id=>$i});
+ "\n ",a({-href=>".html/$name-static.html",
+ -title=>$title,
+ -class=>'showImage',
+ -id=>$name},
+ img({-src=>$thumb})),"\n"),"\n",
+ start_div({-class=>'varimages',-id=>$name}),"\n";
foreach my $sz(@sizes) {
my $src=$self->{$sz}->{'url'};
my $w=$self->{$sz}->{'dim'}->[0];
my $h=$self->{$sz}->{'dim'}->[1];
- print $IND a({-href=>$src,-style=>"display: none;",
- -class=>($sz == 640)?"slideshowThumbnail":"",
+ print $IND " ",a({-href=>$src,
+ -class=>"conceal ".
+ (($sz == 640)?"slideshowThumbnail":""),
-title=>"Reduced to ".$w."x".$h},
- $w."x".$h)," ";
+ $w."x".$h)," \n";
}
- print $IND a({-href=>$name,
+ print $IND " ",a({-href=>$name,
-title=>'Original'},$w."x".$h),
- end_div,"\n",
+ "\n",end_div,"\n",
end_td,end_Tr,end_table,"\n";
}