diff -rubB imageflow_1.2.1_orig/imageflow.css imageflow_1.2.1_modified_2010-02-17/imageflow.css --- imageflow_1.2.1_orig/imageflow.css 2009-08-10 16:49:00.000000000 +0200 +++ imageflow_1.2.1_modified_2010-02-17/imageflow.css 2010-02-17 13:12:22.000000000 +0100 @@ -46,6 +46,11 @@ text-align:center; z-index:10001; } + .imageflow .Imageflow_caption { + position:absolute; + margin:-5000px 0 0 -5000px; + visibility:hidden; + } .imageflow .scrollbar { border-bottom:1px solid #b3b3b3; position:relative; diff -rubB imageflow_1.2.1_orig/imageflow.js imageflow_1.2.1_modified_2010-02-17/imageflow.js --- imageflow_1.2.1_orig/imageflow.js 2009-08-10 16:51:54.000000000 +0200 +++ imageflow_1.2.1_modified_2010-02-17/imageflow.js 2010-02-19 10:50:09.000000000 +0100 @@ -1,7 +1,7 @@ /* Name: ImageFlow -Version: 1.2.1 (August 10 2009) -Author: Finn Rudolph +Version: 1.2.1 (August 10 2009); Modified (2010-02-17) +Author: Finn Rudolph, modified by Ralf Hettinger Support: http://finnrudolph.de/ImageFlow Licence: ImageFlow is licensed under a Creative Commons @@ -55,6 +55,7 @@ percentLandscape: 118, /* Scale landscape format */ percentOther: 100, /* Scale portrait and square format */ preloadImages: true, /* Toggles loading bar (false: requires img attributes height and width) */ + preloadImagesText: 'loading images',/* Text to be shown on preload */ reflections: true, /* Toggle reflections */ reflectionGET: '', /* Pass variables via the GET method to the reflect_.php script */ reflectionP: 0.5, /* Height of the reflection in percent of the source image */ @@ -65,7 +66,13 @@ sliderWidth: 14, /* Width of the slider in px */ startID: 1, /* Glide to this image ID on startup */ startAnimation: false, /* Animate images moving in from the right on startup */ - xStep: 150 /* Step width on the x-axis in px */ + xStep: 150, /* Step width on the x-axis in px */ + animationSpeed: 50, /* time in milliseconds for one transition */ + singleItemTag: 'IMG', /* tagname which will wrap a single item (default IMG, you may want to set it e.g. LI)*/ + slideshow: false, /* enables slideshow */ + slideshowInterval: 2000, /* time in milliseconds for holding one image */ + slideshowLeftToRight: true, /* cycle from left to right (true) or right to left (false) */ + cycle: false /* create cyclic image flow: Mousewheel and Buttons will be able to switch from last to first and vice versa */ }; @@ -77,7 +84,7 @@ this.init = function (options) { /* Evaluate options */ - var optionsArray = ['aspectRatio', 'buttons', 'captions', 'imageCursor', 'imagesM', 'ImageFlowID', 'imageFocusM', 'imageFocusMax', 'imagesHeight', 'onClick', 'opacity', 'opacityArray', 'percentLandscape', 'percentOther', 'preloadImages', 'reflections', 'reflectionGET', 'reflectionP', 'reflectionPNG','imageScaling', 'scrollbarP', 'slider', 'sliderCursor', 'sliderWidth', 'startID', 'startAnimation', 'xStep']; + var optionsArray = ['aspectRatio', 'buttons', 'captions', 'imageCursor', 'imagesM', 'ImageFlowID', 'imageFocusM', 'imageFocusMax', 'imagesHeight', 'onClick', 'opacity', 'opacityArray', 'percentLandscape', 'percentOther', 'preloadImages', 'preloadImagesText', 'reflections', 'reflectionGET', 'reflectionP', 'reflectionPNG','imageScaling', 'scrollbarP', 'slider', 'sliderCursor', 'sliderWidth', 'startID', 'startAnimation', 'xStep', 'animationSpeed', 'singleItemTag', 'slideshow', 'slideshowInterval', 'slideshowLeftToRight', 'cycle']; var max = optionsArray.length; for (var i = 0; i < max; i++) { @@ -116,6 +123,11 @@ /* Toggle Slider */ if(this.slider === false) { + this.sliderDiv.style.display = 'none'; + } + + /* do not show scrollbar, if only 1 element */ + if (this.imagesDiv.childNodes.length < 2) { this.scrollbarDiv.style.display = 'none'; } @@ -143,8 +155,16 @@ for(var index = 0; index < max; index++) { node = this.ImageFlowDiv.childNodes[index]; - if (node && node.nodeType == 1 && node.nodeName == 'IMG') + if (node && node.nodeType == 1 && node.nodeName == thisObject.singleItemTag) { + if (thisObject.singleItemTag != 'IMG') { + var imgNode = this.getImagesFromStructure(node); + if (imgNode) { + node = imgNode; + } else { + continue; + } + } /* Add 'reflect.php?img=' */ if(thisObject.reflections === true) { @@ -206,7 +226,7 @@ for(index = 0; index < max; index++) { node = this.ImageFlowDiv.childNodes[index]; - if (node && node.nodeType == 1 && node.nodeName == 'IMG') + if (node && node.nodeType == 1 && node.nodeName == thisObject.singleItemTag) { this.ImageFlowDiv.removeChild(node); } @@ -216,6 +236,42 @@ return success; }; + /* gets images recursively from within some HTML structure and sets longDesc, if wrapped into a link and / or caption, if a class 'Imageflow_caption' is set */ + this.getImagesFromStructure = function(structure, level) { + if (!level) level = 0; + var imgNode = null; + var linkURL = null; + var caption = null; + var tempNode = null; + var childLength = structure.childNodes.length; + for (var child = 0; child < childLength; child++) { + tempNode = structure.childNodes[child]; + if (tempNode.hasChildNodes()) { + if (!imgNode) { + imgNode = this.getImagesFromStructure(tempNode, level++); + if (tempNode.nodeName == 'A' && tempNode.href && tempNode.href != '') { + linkURL = tempNode.href; + } + } + if (tempNode.className == 'Imageflow_caption') { + caption = tempNode.innerHTML; + } + } else { + if (tempNode) { + if (tempNode.nodeName == 'IMG') { + imgNode = tempNode; + } + } + } + } + if (caption) { + imgNode.setAttribute('alt', caption); + } + if (linkURL) { + imgNode.setAttribute('longdesc', linkURL); + } + return imgNode; + }; /* Manage loading progress and call the refresh function */ this.loadingProgress = function() @@ -261,20 +317,42 @@ { startID = 0; } - if (startID > thisObject.max) + if (startID >= thisObject.max) { startID = thisObject.max -1; } thisObject.glideTo(startID); /* Animate images moving in from the right */ - if(thisObject.startAnimation === true) + if(thisObject.startAnimation === true && thisObject.max > 1) { thisObject.moveTo(5000); } + if (thisObject.slideshow) { + window.setTimeout(thisObject.slideshowImages, thisObject.slideshowInterval); + } } }; + /* create a slideshow */ + this.slideshowImages = function() { + var newImageId = 0; + if (thisObject.slideshowLeftToRight) { + if (thisObject.imageID < (thisObject.max - 1)) { + newImageID = thisObject.imageID + 1; + } else { + newImageID = 0; + } + } else { + if (thisObject.imageID > 0) { + newImageID = thisObject.imageID - 1; + } else { + newImageID = thisObject.max - 1; + } + } + thisObject.glideTo(newImageID); + window.setTimeout(thisObject.slideshowImages, thisObject.slideshowInterval); + }; /* Return loaded images in percent, set loading bar width and loading text */ this.loadingStatus = function() @@ -299,7 +377,7 @@ loadingBar.style.width = finished+'%'; var loadingP = document.getElementById(thisObject.ImageFlowID+'_loading_txt'); - var loadingTxt = document.createTextNode('loading images '+completed+'/'+i); + var loadingTxt = document.createTextNode(thisObject.preloadImagesText+' '+completed+'/'+i); loadingP.replaceChild(loadingTxt,loadingP.firstChild); return finished; }; @@ -571,7 +649,7 @@ thisObject.captionDiv.innerHTML = caption; /* Set scrollbar slider to new position */ - if (thisObject.MouseDrag.busy === false) + if (thisObject.MouseDrag.busy === false && thisObject.max > 1) { this.newSliderX = (imageID * thisObject.scrollbarWidth) / (thisObject.max-1) - thisObject.MouseDrag.newX; thisObject.sliderDiv.style.marginLeft = (thisObject.newSliderX - thisObject.sliderWidth) + 'px'; @@ -608,11 +686,17 @@ { thisObject.Helper.setOpacity(thisObject.imagesDiv.childNodes[rightID], opacityValue); thisObject.imagesDiv.childNodes[rightID].pc = thisObject.imagesDiv.childNodes[rightID].pcMem; + } else if (thisObject.cycle && thisObject.max > 2) { + thisObject.Helper.setOpacity(thisObject.imagesDiv.childNodes[0], opacityValue); + thisObject.imagesDiv.childNodes[0].pc = thisObject.imagesDiv.childNodes[0].pcMem; } if (leftID >= 0) { thisObject.Helper.setOpacity(thisObject.imagesDiv.childNodes[leftID], opacityValue); thisObject.imagesDiv.childNodes[leftID].pc = thisObject.imagesDiv.childNodes[leftID].pcMem; + } else if (thisObject.cycle && thisObject.max > 2) { + thisObject.Helper.setOpacity(thisObject.imagesDiv.childNodes[thisObject.max - 1], opacityValue); + thisObject.imagesDiv.childNodes[thisObject.max - 1].pc = thisObject.imagesDiv.childNodes[thisObject.max - 1].pcMem; } } } @@ -633,7 +717,7 @@ { case true: thisObject.moveTo(thisObject.current + (thisObject.target-thisObject.current)/3); - window.setTimeout(thisObject.animate, 50); + window.setTimeout(thisObject.animate, thisObject.animationSpeed); thisObject.busy = true; break; @@ -689,6 +773,9 @@ { newImageID = thisObject.imageID -1; change = true; + } else if(thisObject.cycle) { + newImageID = thisObject.max-1 + change = true; } } else @@ -697,6 +784,9 @@ { newImageID = thisObject.imageID +1; change = true; + } else if(thisObject.cycle) { + newImageID = 0; + change = true; } } Only in imageflow_1.2.1_modified_2010-02-17: .#index.html diff -rubB imageflow_1.2.1_orig/index.html imageflow_1.2.1_modified_2010-02-17/index.html --- imageflow_1.2.1_orig/index.html 2009-08-10 16:56:36.000000000 +0200 +++ imageflow_1.2.1_modified_2010-02-17/index.html 2010-02-17 13:18:25.000000000 +0100 @@ -10,6 +10,12 @@ + + +
+
+
+
+