4 This is a part of mkgallery.pl suite
5 http://www.average.org/mkgallery/
7 Uses mootools (1.2) http://www.mootools.net/
8 Uses multibox http://www.phatfusion.net/multibox/
9 Inspired by slideshow http://www.phatfusion.net/slideshow/
13 Use slideshow classes with the index generated by mkgallery.pl
16 /* Initialize everything, to be called on domready */
17 function init_gallery() {
19 /* List of lists of img variations. Each image variation is a three-element
20 * array: [width, height, url]. Index of the outer array is the global ID.
24 * [ width, height, url ]
34 /* resolve string ID to index No which is the index in vimgs[] array */
37 /* Populate images list */
39 $$('div.varimages').each(function(el,i){
42 el.getElements('a').each(function(ael,j){
43 dim = /(\d+)[^\d](\d+)/.exec(ael.text);
46 vimgs[i][j]=[w,h,ael.href,el.id,el.title];
51 var msg='loaded '+vimgs.length+' image descriptions:';
52 vimgs.each(function(vimg,i){
54 vimg.each(function(vimg,i){
55 msg+='\n w='+vimg[0]+' h='+vimg[1]+' url='+vimg[2];
59 /* end debugging output */
61 /* Initialize objects */
64 ovl = new overlay(ovlparams);
73 descClassName: 'infoBoxDesc',
75 ibox = new multiBox('infoBox', iboxparams);
78 tohide: 'indexContainer',
80 var showwin = new showWindow('slideshowContainer',winparms);
84 var ctl = new Controls('slideshowControls','slideshowContainer',
88 cbStart: function(){ showwin.show(); },
89 cbExit: function(){ showwin.hide(); },
91 var show = new Show(vimgs,showwin,ctl,showparms);
95 $$('.conceal').each(function(el){
96 el.setStyle('display', 'none');
98 $$('a.infoBox').each(function(el){
99 var url=el.get('href');
100 el.set('href',url+'?conceal');
103 $$('a.showStart').each(function(el){
105 show.start.bind(show,[rimgs[el.get('id')],1]));
107 $$('a.showImage').each(function(el){
109 show.start.bind(show,[rimgs[el.get('id')],0]));
112 /* Determine if we need to go directly into show mode */
114 parsedurl = parseUrl(document.URL);
115 /* alert('Anchor: '+parsedurl['anchor']+'\nURL: '+document.URL); */
116 if ($chk(parsedurl['anchor'])){
117 show.start(rimgs[parsedurl['anchor']],0);
122 window.addEvent('domready',init_gallery)