diff -r bd5069e1f19a -r c7d737202d59 includes/clientside/static/SpryEffects.js --- a/includes/clientside/static/SpryEffects.js Sun Aug 17 23:24:41 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,521 +0,0 @@ -// Spry.Effect.js - version 0.38 - Spry Pre-Release 1.6.1 -// -// Copyright (c) 2007. Adobe Systems Incorporated. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Adobe Systems Incorporated nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -var Spry;if(!Spry)Spry={};Spry.forwards=1;Spry.backwards=2;if(!Spry.Effect)Spry.Effect={};Spry.Effect.Transitions={linearTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;return begin+(time/duration)*change;},sinusoidalTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;return begin+((-Math.cos((time/duration)*Math.PI)/2)+0.5)*change;},squareTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;return begin+Math.pow(time/duration,2)*change;},squarerootTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;return begin+Math.sqrt(time/duration)*change;},fifthTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;return begin+Math.sqrt((-Math.cos((time/duration)*Math.PI)/2)+0.5)*change;},circleTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;var pos=time/duration;return begin+Math.sqrt(1-Math.pow((pos-1),2))*change;},pulsateTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;return begin+(0.5+Math.sin(17*time/duration)/2)*change;},growSpecificTransition:function(time,begin,change,duration) -{if(time>duration)return change+begin;var pos=time/duration;return begin+(5*Math.pow(pos,3)-6.4*Math.pow(pos,2)+2*pos)*change;}};for(var trans in Spry.Effect.Transitions) -{Spry[trans]=Spry.Effect.Transitions[trans];} -Spry.Effect.Registry=function() -{this.effects=[];};Spry.Effect.Registry.prototype.getRegisteredEffect=function(element,options) -{var a={};a.element=Spry.Effect.getElement(element);a.options=options;for(var i=0;i0) -{if(isFirstEntry) -{camelizedString=oStringList[i];isFirstEntry=false;} -else -{var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}}} -return camelizedString;};Spry.Effect.Utils.isPercentValue=function(value) -{var result=false;if(typeof value=='string'&&value.length>0&&value.lastIndexOf("%")>0) -result=true;return result;};Spry.Effect.Utils.getPercentValue=function(value) -{var result=0;try -{result=Number(value.substring(0,value.lastIndexOf("%")));} -catch(e){Spry.Effect.Utils.showError('Spry.Effect.Utils.getPercentValue: '+e);} -return result;};Spry.Effect.Utils.getPixelValue=function(value) -{var result=0;if(typeof value=='number')return value;var unitIndex=value.lastIndexOf("px");if(unitIndex==-1) -unitIndex=value.length;try -{result=parseInt(value.substring(0,unitIndex),10);} -catch(e){} -return result;};Spry.Effect.Utils.getFirstChildElement=function(node) -{if(node) -{var childCurr=node.firstChild;while(childCurr) -{if(childCurr.nodeType==1) -return childCurr;childCurr=childCurr.nextSibling;}} -return null;};Spry.Effect.Utils.fetchChildImages=function(startEltIn,targetImagesOut) -{if(!startEltIn||startEltIn.nodeType!=1||!targetImagesOut) -return;if(startEltIn.hasChildNodes()) -{var childImages=startEltIn.getElementsByTagName('img');var imageCnt=childImages.length;for(var i=0;i=0;i--){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue)) -try -{element.removeChild(node);} -catch(e){Spry.Effect.Utils.showError('Spry.Effect.cleanWhitespace: '+e);}}};Spry.Effect.getComputedStyle=function(element) -{return/MSIE/.test(navigator.userAgent)?element.currentStyle:document.defaultView.getComputedStyle(element,null);};Spry.Effect.getDimensions=function(element) -{var dimensions=new Spry.Effect.Utils.Rectangle;var computedStyle=null;if(element.style.width&&/px/i.test(element.style.width)) -dimensions.width=parseInt(element.style.width,10);else -{computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.width&&/px/i.test(computedStyle.width);if(tryComputedStyle) -dimensions.width=parseInt(computedStyle.width,10);if(!tryComputedStyle||dimensions.width==0) -dimensions.width=element.offsetWidth;} -if(element.style.height&&/px/i.test(element.style.height)) -dimensions.height=parseInt(element.style.height,10);else -{if(!computedStyle) -computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.height&&/px/i.test(computedStyle.height);if(tryComputedStyle) -dimensions.height=parseInt(computedStyle.height,10);if(!tryComputedStyle||dimensions.height==0) -dimensions.height=element.offsetHeight;} -return dimensions;};Spry.Effect.getDimensionsRegardlessOfDisplayState=function(element,displayElement) -{var refElement=displayElement?displayElement:element;var displayOrig=Spry.Effect.getStyleProp(refElement,'display');var visibilityOrig=Spry.Effect.getStyleProp(refElement,'visibility');if(displayOrig=='none') -{Spry.Effect.setStyleProp(refElement,'visibility','hidden');Spry.Effect.setStyleProp(refElement,'display','block');if(window.opera) -refElement.focus();} -var dimensions=Spry.Effect.getDimensions(element);if(displayOrig=='none') -{Spry.Effect.setStyleProp(refElement,'display','none');Spry.Effect.setStyleProp(refElement,'visibility',visibilityOrig);} -return dimensions;};Spry.Effect.getOpacity=function(element) -{var o=Spry.Effect.getStyleProp(element,"opacity");if(typeof o=='undefined'||o==null) -o=1.0;return o;};Spry.Effect.getBgColor=function(ele) -{return Spry.Effect.getStyleProp(ele,"background-color");};Spry.Effect.intPropStyle=function(e,prop){var i=parseInt(Spry.Effect.getStyleProp(e,prop),10);if(isNaN(i)) -return 0;return i;};Spry.Effect.getPosition=function(element) -{var position=new Spry.Effect.Utils.Position;var computedStyle=null;if(element.style.left&&/px/i.test(element.style.left)) -position.x=parseInt(element.style.left,10);else -{computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.left&&/px/i.test(computedStyle.left);if(tryComputedStyle) -position.x=parseInt(computedStyle.left,10);if(!tryComputedStyle||position.x==0) -position.x=element.offsetLeft;} -if(element.style.top&&/px/i.test(element.style.top)) -position.y=parseInt(element.style.top,10);else -{if(!computedStyle) -computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.top&&/px/i.test(computedStyle.top);if(tryComputedStyle) -position.y=parseInt(computedStyle.top,10);if(!tryComputedStyle||position.y==0) -position.y=element.offsetTop;} -return position;};Spry.Effect.getOffsetPosition=Spry.Effect.getPosition;Spry.Effect.Animator=function(options) -{Spry.Utils.Notifier.call(this);this.name='Animator';this.element=null;this.startMilliseconds=0;this.repeat='none';this.isRunning=false;this.timer=null;this.cancelRemaining=0;if(!options) -var options={};if(options.toggle) -this.direction=false;else -this.direction=Spry.forwards;var self=this;if(options.setup!=null) -this.addObserver({onPreEffect:function(){try{self.options.setup(self.element,self);}catch(e){Spry.Effect.Utils.showError('Spry.Effect.Animator.prototype.start: setup callback: '+e);}}});if(options.finish!=null) -this.addObserver({onPostEffect:function(){try{self.options.finish(self.element,self);}catch(e){Spry.Effect.Utils.showError('Spry.Effect.Animator.prototype.stop: finish callback: '+e);}}});this.options={duration:1000,toggle:false,transition:Spry.linearTransition,interval:16};this.setOptions(options);if(options.transition) -this.setTransition(options.transition);if(options.fps) -this.setFps(options.fps);};Spry.Effect.Animator.prototype=new Spry.Utils.Notifier();Spry.Effect.Animator.prototype.constructor=Spry.Utils.Animator;Spry.Effect.Animator.prototype.notStaticAnimator=true;Spry.Effect.Animator.prototype.setOptions=function(options) -{if(!options) -return;for(var prop in options) -this.options[prop]=options[prop];};Spry.Effect.Animator.prototype.setTransition=function(transition){if(typeof transition=='number'||transition=="1"||transition=="2") -switch(parseInt(transition,10)) -{case 1:transition=Spry.linearTransition;break;case 2:transition=Spry.sinusoidalTransition;break;default:Spry.Effect.Utils.showError('unknown transition');} -else if(typeof transition=='string') -{if(typeof window[transition]=='function') -transition=window[transition];else if(typeof Spry[transition]=='function') -transition=Spry[transition];else -Spry.Effect.Utils.showError('unknown transition');} -this.options.transition=transition;if(typeof this.effectsArray!='undefined'){var l=this.effectsArray.length;for(var i=0;ithis.options.duration)break;var half=startTime+((stopTime-startTime)/2);middle=Math.round(this.options.transition(half,1,-1,this.options.duration)*1000)/1000;if(middle==this.cancelRemaining) -{this.startMilliseconds-=half;found=true;} -if(middle0&&elapsedthis.options.duration) -{isRunning=false;this.stop();} -return isRunning;};Spry.Effect.Animator.prototype.getElapsedMilliseconds=function() -{if(this.startMilliseconds>0) -{var currDate=new Date();return(currDate.getTime()-this.startMilliseconds);} -return 0;};Spry.Effect.Animator.prototype.doToggle=function() -{if(!this.direction) -{this.direction=Spry.forwards;return;} -if(this.options.toggle==true) -{if(this.direction==Spry.forwards) -{this.direction=Spry.backwards;this.notifyObservers('onToggle',this);} -else if(this.direction==Spry.backwards) -{this.direction=Spry.forwards;}}};Spry.Effect.Animator.prototype.prepareStart=function() -{if(this.options&&this.options.toggle) -this.doToggle();};Spry.Effect.Animator.prototype.animate=function(){};Spry.Effect.Animator.prototype.onStep=function(el) -{if(el!=this) -this.notifyObservers('onStep',this);};Spry.Effect.Move=function(element,fromPos,toPos,options) -{this.dynamicFromPos=false;if(arguments.length==3) -{options=toPos;toPos=fromPos;fromPos=Spry.Effect.getPosition(element);this.dynamicFromPos=true;} -Spry.Effect.Animator.call(this,options);this.name='Move';this.element=Spry.Effect.getElement(element);if(!this.element) -return;if(fromPos.units!=toPos.units) -Spry.Effect.Utils.showError('Spry.Effect.Move: Conflicting units ('+fromPos.units+', '+toPos.units+')');this.units=fromPos.units;this.startX=Number(fromPos.x);this.stopX=Number(toPos.x);this.startY=Number(fromPos.y);this.stopY=Number(toPos.y);};Spry.Effect.Move.prototype=new Spry.Effect.Animator();Spry.Effect.Move.prototype.constructor=Spry.Effect.Move;Spry.Effect.Move.prototype.animate=function() -{var left=0;var top=0;var floor=Math.floor;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards) -{left=floor(this.options.transition(elapsed,this.startX,this.stopX-this.startX,this.options.duration));top=floor(this.options.transition(elapsed,this.startY,this.stopY-this.startY,this.options.duration));} -else if(this.direction==Spry.backwards) -{left=floor(this.options.transition(elapsed,this.stopX,this.startX-this.stopX,this.options.duration));top=floor(this.options.transition(elapsed,this.stopY,this.startY-this.stopY,this.options.duration));} -this.element.style.left=left+this.units;this.element.style.top=top+this.units;};Spry.Effect.Move.prototype.prepareStart=function() -{if(this.options&&this.options.toggle) -this.doToggle();if(this.dynamicFromPos==true) -{var fromPos=Spry.Effect.getPosition(this.element);this.startX=fromPos.x;this.startY=fromPos.y;this.rangeMoveX=this.startX-this.stopX;this.rangeMoveY=this.startY-this.stopY;}};Spry.Effect.Size=function(element,fromRect,toRect,options) -{this.dynamicFromRect=false;if(arguments.length==3) -{options=toRect;toRect=fromRect;fromRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);this.dynamicFromRect=true;} -Spry.Effect.Animator.call(this,options);this.name='Size';this.element=Spry.Effect.getElement(element);if(!this.element) -return;element=this.element;if(fromRect.units!=toRect.units) -{Spry.Effect.Utils.showError('Spry.Effect.Size: Conflicting units ('+fromRect.units+', '+toRect.units+')');return false;} -this.units=fromRect.units;var originalRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);this.originalWidth=originalRect.width;this.originalHeight=originalRect.height;this.startWidth=fromRect.width;this.startHeight=fromRect.height;this.stopWidth=toRect.width;this.stopHeight=toRect.height;this.childImages=new Array();if(this.options.useCSSBox){Spry.Effect.makePositioned(this.element);var intProp=Spry.Effect.intPropStyle;this.startFromBorder_top=intProp(element,'border-top-width');this.startFromBorder_bottom=intProp(element,'border-bottom-width');this.startFromBorder_left=intProp(element,'border-left-width');this.startFromBorder_right=intProp(element,'border-right-width');this.startFromPadding_top=intProp(element,'padding-top');this.startFromPadding_bottom=intProp(element,'padding-bottom');this.startFromPadding_left=intProp(element,'padding-left');this.startFromPadding_right=intProp(element,'padding-right');this.startFromMargin_top=intProp(element,'margin-top');this.startFromMargin_bottom=intProp(element,'margin-bottom');this.startFromMargin_right=intProp(element,'margin-right');this.startFromMargin_left=intProp(element,'margin-left');this.startLeft=intProp(element,'left');this.startTop=intProp(element,'top');} -if(this.options.scaleContent) -Spry.Effect.Utils.fetchChildImages(element,this.childImages);this.fontFactor=1.0;var fontSize=Spry.Effect.getStyleProp(this.element,'font-size');if(fontSize&&/em\s*$/.test(fontSize)) -this.fontFactor=parseFloat(fontSize);var isPercent=Spry.Effect.Utils.isPercentValue;if(isPercent(this.startWidth)) -{var startWidthPercent=Spry.Effect.Utils.getPercentValue(this.startWidth);this.startWidth=originalRect.width*(startWidthPercent/100);} -if(isPercent(this.startHeight)) -{var startHeightPercent=Spry.Effect.Utils.getPercentValue(this.startHeight);this.startHeight=originalRect.height*(startHeightPercent/100);} -if(isPercent(this.stopWidth)) -{var stopWidthPercent=Spry.Effect.Utils.getPercentValue(this.stopWidth);this.stopWidth=originalRect.width*(stopWidthPercent/100);} -if(isPercent(this.stopHeight)) -{var stopHeightPercent=Spry.Effect.Utils.getPercentValue(this.stopHeight);this.stopHeight=originalRect.height*(stopHeightPercent/100);} -this.enforceVisible=Spry.Effect.isInvisible(this.element);};Spry.Effect.Size.prototype=new Spry.Effect.Animator();Spry.Effect.Size.prototype.constructor=Spry.Effect.Size;Spry.Effect.Size.prototype.animate=function() -{var width=0;var height=0;var fontSize=0;var direction=0;var floor=Math.floor;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards){width=floor(this.options.transition(elapsed,this.startWidth,this.stopWidth-this.startWidth,this.options.duration));height=floor(this.options.transition(elapsed,this.startHeight,this.stopHeight-this.startHeight,this.options.duration));direction=1;}else if(this.direction==Spry.backwards){width=floor(this.options.transition(elapsed,this.stopWidth,this.startWidth-this.stopWidth,this.options.duration));height=floor(this.options.transition(elapsed,this.stopHeight,this.startHeight-this.stopHeight,this.options.duration));direction=-1;} -var propFactor=width/this.originalWidth;fontSize=this.fontFactor*propFactor;var elStyle=this.element.style;if(width<0) -width=0;if(height<0) -height=0;elStyle.width=width+this.units;elStyle.height=height+this.units;if(typeof this.options.useCSSBox!='undefined'&&this.options.useCSSBox==true) -{var intProp=Spry.Effect.intPropStyle;var origTop=intProp(this.element,'top');var origLeft=intProp(this.element,'left');var origMarginTop=intProp(this.element,'margin-top');var origMarginLeft=intProp(this.element,'margin-left');var widthFactor=propFactor;var heightFactor=height/this.originalHeight;var border_top=floor(this.startFromBorder_top*heightFactor);var border_bottom=floor(this.startFromBorder_bottom*heightFactor);var border_left=floor(this.startFromBorder_left*widthFactor);var border_right=floor(this.startFromBorder_right*widthFactor);var padding_top=floor(this.startFromPadding_top*heightFactor);var padding_bottom=floor(this.startFromPadding_bottom*heightFactor);var padding_left=floor(this.startFromPadding_left*widthFactor);var padding_right=floor(this.startFromPadding_right*widthFactor);var margin_top=floor(this.startFromMargin_top*heightFactor);var margin_bottom=floor(this.startFromMargin_bottom*heightFactor);var margin_right=floor(this.startFromMargin_right*widthFactor);var margin_left=floor(this.startFromMargin_left*widthFactor);elStyle.borderTopWidth=border_top+this.units;elStyle.borderBottomWidth=border_bottom+this.units;elStyle.borderLeftWidth=border_left+this.units;elStyle.borderRightWidth=border_right+this.units;elStyle.paddingTop=padding_top+this.units;elStyle.paddingBottom=padding_bottom+this.units;elStyle.paddingLeft=padding_left+this.units;elStyle.paddingRight=padding_right+this.units;elStyle.marginTop=margin_top+this.units;elStyle.marginBottom=margin_bottom+this.units;elStyle.marginLeft=margin_left+this.units;elStyle.marginRight=margin_right+this.units;elStyle.left=floor(origLeft+origMarginLeft-margin_left)+this.units;elStyle.top=floor(origTop+origMarginTop-margin_top)+this.units;} -if(this.options.scaleContent) -{for(var i=0;i(this.effectsArray.length-1)&&this.direction==Spry.forwards)||(this.currIdx<0&&this.direction==Spry.backwards)) -allEffectsDidRun=true;else -for(var i=this.currIdx;i!=stop;i+=step) -{if((i>this.currIdx&&this.direction==Spry.forwards||i0&&elapsed