X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fgallery.js;h=0900c799e99a70185a57c87be1738bfe9643906c;hp=5d24752b5e2c2b24c81153b7a38029397eafe462;hb=a01bd7a3ca127d89ae4a2d55c289c0c13ae70693;hpb=224aa7103c52952fe867c36d3cb4f7217f4fbc4c diff --git a/include/gallery.js b/include/gallery.js index 5d24752..0900c79 100644 --- a/include/gallery.js +++ b/include/gallery.js @@ -115,8 +115,41 @@ function stop_slideshow() { return false; } +/* List of lists of img variations. Each image variation is a three-element */ +/* array: [width, height, url]. Index of the outer array is the global ID. */ +var vimgs=[] +/* + * [ + * [ + * [width, height, url] + * ... + * ] + * ... + * ] +*/ /* Initialize everything, to be called on domready */ function init_gallery() { + $$('div.varimages').each(function(el){ + var id=el.id + vimgs[id]=[] + el.getElements('a').each(function(ael,i){ + dim = /(\d+)[^\d](\d+)/.exec(ael.text) + w = dim[1] + h = dim[2] + vimgs[id][i]=[w,h,ael.href] + }) + }) + /* debugging output + var msg='loaded '+vimgs.length+' image descriptions:' + vimgs.each(function(vimg,i){ + msg+='\nid='+i + vimg.each(function(vimg,i){ + msg+='\n w='+vimg[0]+' h='+vimg[1]+' url='+vimg[2] + }) + }) + alert(msg) + /* end debugging output */ + var winparms = {} showwin = new ShowWindow('slideshowWindow',winparms) @@ -136,3 +169,6 @@ function init_gallery() { run_slideshow(parsedurl['anchor']) } } + +/* Initialization */ +window.addEvent('domready',init_gallery)