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
20 * a three-element array: [width, height, url]. Index of the
21 * outer array is the global ID.
25 * [ width, height, url ]
35 /* resolve string ID to index No which is the index in vimgs[] array */
38 /* Populate images list */
40 $$('div.varimages').each(function(el,i){
42 vimgs[i] = [el.id, el.title, []];
43 el.getElements('a').each(function(ael,j){
44 dim = /(\d+)[^\d](\d+)/.exec(ael.text);
47 vimgs[i][2][j]=[w,h,ael.href];
52 var msg='loaded '+vimgs.length+' image descriptions:';
53 vimgs.each(function(vimg,i){
54 msg+='\nid='+i+' ('+vimg[0]+') title='+vimg[1];
55 vimg[2].each(function(vv,i){
56 msg+='\n w='+vv[0]+' h='+vv[1]+' url='+vv[2];
60 /* end debugging output */
62 /* Initialize objects */
65 ovl = new overlay(ovlparams);
74 descClassName: 'infoBoxDesc',
76 ibox = new multiBox('infoBox', iboxparams);
79 tohide: 'indexContainer',
81 var showwin = new showWindow('slideshowContainer',winparms);
85 var ctl = new Controls('slideshowControls','slideshowContainer',
89 cbStart: function(){ showwin.show(); },
90 cbExit: function(){ showwin.hide(); },
92 var show = new Show(vimgs,showwin,ctl,showparms);
96 $$('.conceal').each(function(el){
97 el.setStyle('display', 'none');
99 $$('a.infoBox').each(function(el){
100 var url=el.get('href');
101 el.set('href',url+'?conceal');
104 $$('a.showStart').each(function(el){
106 show.start.bind(show,[rimgs[el.get('id')],1]));
108 $$('a.showImage').each(function(el){
110 show.start.bind(show,[rimgs[el.get('id')],0]));
113 /* Determine if we need to go directly into show mode */
115 parsedurl = parseUrl(document.URL);
116 /* alert('Anchor: '+parsedurl['anchor']+'\nURL: '+document.URL); */
117 if ($chk(parsedurl['anchor'])){
118 show.start(rimgs[parsedurl['anchor']],0);
123 window.addEvent('domready',init_gallery);
125 /* This is how I would like it done for explorer:
126 window.addEvent('readystatechange',function(parm){
127 alert('readystatechange, parm='+parm);
130 /* but it does not seem to work */