X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fgallery.js;h=d0f9760a84fe87b460852c3325e4592c5fd5e4db;hp=5d24752b5e2c2b24c81153b7a38029397eafe462;hb=481af6c9567c2f71575e7e3464103937d6025ce4;hpb=224aa7103c52952fe867c36d3cb4f7217f4fbc4c diff --git a/include/gallery.js b/include/gallery.js index 5d24752..d0f9760 100644 --- a/include/gallery.js +++ b/include/gallery.js @@ -6,41 +6,17 @@ Uses slideshow http://www.phatfusion.net/slideshow/ */ -function showIbox(iboxid) { - var ibox = document.getElementById(iboxid); - var bwidth = 400; - var bheight = 300; - - var wwidth = window.getWidth(); - var wheight = window.getHeight(); - - ibox.style.top = window.getScrollTop() + ((wheight - bheight) / 2) + 'px'; - ibox.style.left = ((wwidth - bwidth) / 2) + "px"; - ibox.style.width = bwidth + "px"; - ibox.style.height = bheight + "px"; - // alert('wwidth='+wwidth+'; bwidth='+bwidth+'; wheight='+wheight+'; bheight='+bheight); - ibox.zIndex = '0'; - ibox.style.display = 'block'; - return false; -} -function HideIbox(iboxid) { - var ibox = document.getElementById(iboxid); - ibox.zIndex = '1000'; - ibox.style.display = 'none'; - return false; -} - /* Slideshow */ -var ShowWindow = new Class({ +var showWindow = new Class({ getOptions: function(){ return { zIndex: 2, container: document.body, - onClick: Class.empty + onClick: $empty, }; }, @@ -93,7 +69,7 @@ var ShowWindow = new Class({ this.div.setStyles({display: 'none'}); } }); -ShowWindow.implement(new Options); +showWindow.implement(new Options); /* Make overlay window and start slideshow */ function run_slideshow(startid) { @@ -115,10 +91,51 @@ 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 iboxparams = { + useOverlay: true, + showNumbers: false, + openFromLink: false, + descClassName: 'infoboxdesc', + } + ibox = new multiBox('infobox', iboxparams) + var winparms = {} - showwin = new ShowWindow('slideshowWindow',winparms) + showwin = new showWindow('slideshowWindow',winparms) var showparms = { wait: 3000, @@ -128,7 +145,7 @@ function init_gallery() { thumbnails: true, onClick: function(i){alert(i)} } - show = new SlideShow('slideshowContainer','slideshowThumbnail',showparms) + show = new slideShow('slideshowContainer','slideshowThumbnail',showparms) parsedurl = parseUrl(document.URL) // alert('Anchor: '+parsedurl['anchor']+'\nURL: '+document.URL) @@ -136,3 +153,6 @@ function init_gallery() { run_slideshow(parsedurl['anchor']) } } + +/* Initialization */ +window.addEvent('domready',init_gallery)