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 slideshow http://www.phatfusion.net/slideshow/
12 Use slideshow classes with the index generated by mkgallery.pl
15 var showControls = new Class({
17 getOptions: function(){
27 initialize: function(name,options){
28 this.setOptions(this.getOptions(), options)
30 this.container = $(name)
32 var buttons = ['prev','stop','play','next','exit','comm']
33 buttons.each(function(el){
34 var sub = new Element('div')
35 if (this.options[el]) {
36 sub.addEvent('click', function() {
40 sub.addClass('controlButton').setProperties({
43 }).injectInside(this.container)
48 showControls.implement(new Options)
50 /* Make overlay window and start slideshow */
51 function showImage(id,doplay) {
53 /* alert('show id='+id+' index='+i+' doplay='+doplay) */
62 /* Stop slideshow and return to index page */
69 /* List of lists of img variations. Each image variation is a three-element */
70 /* array: [width, height, url]. Index of the outer array is the global ID. */
75 * [ width, height, url ]
83 /* resolve string ID to index No which is the index in vimgs[] array */
86 /* Initialize everything, to be called on domready */
87 function init_gallery() {
88 $$('.conceal').each(function(el){
89 el.setStyle('display', 'none')
91 $$('a.infoBox').each(function(el){
92 var url=el.get('href')
93 el.set('href',url+'?conceal')
95 $$('a.showStart').each(function(el){
96 el.addEvent('click', showImage.bind(el,[el.get('id'),1]))
98 $$('a.showImage').each(function(el){
99 el.addEvent('click', showImage.bind(el,[el.get('id'),0]))
101 $$('div.varimages').each(function(el,i){
104 el.getElements('a').each(function(ael,j){
105 dim = /(\d+)[^\d](\d+)/.exec(ael.text)
108 vimgs[i][j]=[w,h,ael.href,el.id,el.title]
113 var msg='loaded '+vimgs.length+' image descriptions:'
114 vimgs.each(function(vimg,i){
116 vimg.each(function(vimg,i){
117 msg+='\n w='+vimg[0]+' h='+vimg[1]+' url='+vimg[2]
121 /* end debugging output */
124 ovl = new overlay(ovlparams)
133 descClassName: 'infoBoxDesc',
135 ibox = new multiBox('infoBox', iboxparams)
138 /* onClick: showStop, /* temporarily */
139 embed: ['slideshowControls'],
141 showwin = new showWindow('slideshowContainer',winparms)
149 onClick: function(i){alert(i)},
152 show = new slideShow('slideshowContainer',vimgs,showparms)
155 next: function(){show.next()},
156 prev: function(){show.previous()},
157 stop: function(){show.stop()},
158 play: function(){show.play()},
159 exit: function(){showStop()},
161 ctl = new showControls('slideshowControls',ctlparams)
163 parsedurl = parseUrl(document.URL)
164 /* alert('Anchor: '+parsedurl['anchor']+'\nURL: '+document.URL) */
165 if ($chk(parsedurl['anchor'])){
166 showImage(parsedurl['anchor'],0)
171 window.addEvent('domready',init_gallery)