author | Dan |
Wed, 02 Jul 2008 19:36:44 -0400 | |
changeset 592 | 27377179fe58 |
parent 520 | 4c16e87cfeae |
permissions | -rw-r--r-- |
520
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
1 |
// Spry.Effect.js - version 0.38 - Spry Pre-Release 1.6.1 |
174
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
2 |
// |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
3 |
// Copyright (c) 2007. Adobe Systems Incorporated. |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
4 |
// All rights reserved. |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
5 |
// |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
6 |
// Redistribution and use in source and binary forms, with or without |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
7 |
// modification, are permitted provided that the following conditions are met: |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
8 |
// |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
9 |
// * Redistributions of source code must retain the above copyright notice, |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
10 |
// this list of conditions and the following disclaimer. |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
11 |
// * Redistributions in binary form must reproduce the above copyright notice, |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
12 |
// this list of conditions and the following disclaimer in the documentation |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
13 |
// and/or other materials provided with the distribution. |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
14 |
// * Neither the name of Adobe Systems Incorporated nor the names of its |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
15 |
// contributors may be used to endorse or promote products derived from this |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
16 |
// software without specific prior written permission. |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
17 |
// |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
18 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
19 |
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
20 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
21 |
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
22 |
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
23 |
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
24 |
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
25 |
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
26 |
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
27 |
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
4c5c2b66a34d
SECURITY: remove debug message in session manager; implemented alternate MediaWiki syntax for template embedding; added Adobe Spry for "shake" effect on unsuccessful login
Dan
parents:
diff
changeset
|
28 |
// POSSIBILITY OF SUCH DAMAGE. |
520
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
29 |
|
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
30 |
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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
31 |
{if(time>duration)return change+begin;return begin+(time/duration)*change;},sinusoidalTransition:function(time,begin,change,duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
32 |
{if(time>duration)return change+begin;return begin+((-Math.cos((time/duration)*Math.PI)/2)+0.5)*change;},squareTransition:function(time,begin,change,duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
33 |
{if(time>duration)return change+begin;return begin+Math.pow(time/duration,2)*change;},squarerootTransition:function(time,begin,change,duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
34 |
{if(time>duration)return change+begin;return begin+Math.sqrt(time/duration)*change;},fifthTransition:function(time,begin,change,duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
35 |
{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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
36 |
{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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
37 |
{if(time>duration)return change+begin;return begin+(0.5+Math.sin(17*time/duration)/2)*change;},growSpecificTransition:function(time,begin,change,duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
38 |
{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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
39 |
{Spry[trans]=Spry.Effect.Transitions[trans];} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
40 |
Spry.Effect.Registry=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
41 |
{this.effects=[];};Spry.Effect.Registry.prototype.getRegisteredEffect=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
42 |
{var a={};a.element=Spry.Effect.getElement(element);a.options=options;for(var i=0;i<this.effects.length;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
43 |
if(this.effectsAreTheSame(this.effects[i],a)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
44 |
return this.effects[i].effect;return false;};Spry.Effect.Registry.prototype.addEffect=function(effect,element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
45 |
{if(!this.getRegisteredEffect(element,options)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
46 |
{var len=this.effects.length;this.effects[len]={};var eff=this.effects[len];eff.effect=effect;eff.element=Spry.Effect.getElement(element);eff.options=options;}};Spry.Effect.Registry.prototype.effectsAreTheSame=function(effectA,effectB) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
47 |
{if(effectA.element!=effectB.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
48 |
return false;var compare=Spry.Effect.Utils.optionsAreIdentical(effectA.options,effectB.options);if(compare) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
49 |
{if(typeof effectB.options.setup=='function') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
50 |
effectA.options.setup=effectB.options.setup;if(typeof effectB.options.finish=='function') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
51 |
effectA.options.finish=effectB.options.finish;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
52 |
return compare;};var SpryRegistry=new Spry.Effect.Registry;if(!Spry.Effect.Utils)Spry.Effect.Utils={};Spry.Effect.Utils.showError=function(msg) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
53 |
{alert('Spry.Effect ERR: '+msg);};Spry.Effect.Utils.showInitError=function(effect){Spry.Effect.Utils.showError('The '+effect+' class can\'t be accessed as a static function anymore. '+"\n"+'Please read Spry Effects migration documentation.');return false;};Spry.Effect.Utils.Position=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
54 |
{this.x=0;this.y=0;this.units="px";};Spry.Effect.Utils.Rectangle=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
55 |
{this.width=0;this.height=0;this.units="px";};Spry.Effect.Utils.intToHex=function(integerNum) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
56 |
{var result=integerNum.toString(16);if(result.length==1) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
57 |
result="0"+result;return result;};Spry.Effect.Utils.hexToInt=function(hexStr) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
58 |
{return parseInt(hexStr,16);};Spry.Effect.Utils.rgb=function(redInt,greenInt,blueInt) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
59 |
{var intToHex=Spry.Effect.Utils.intToHex;var redHex=intToHex(redInt);var greenHex=intToHex(greenInt);var blueHex=intToHex(blueInt);compositeColorHex=redHex.concat(greenHex,blueHex).toUpperCase();compositeColorHex='#'+compositeColorHex;return compositeColorHex;};Spry.Effect.Utils.longColorVersion=function(color){if(color.match(/^#[0-9a-f]{3}$/i)){var tmp=color.split('');var color='#';for(var i=1;i<tmp.length;i++){color+=tmp[i]+''+tmp[i];}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
60 |
return color;};Spry.Effect.Utils.camelize=function(stringToCamelize) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
61 |
{if(stringToCamelize.indexOf('-')==-1){return stringToCamelize;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
62 |
var oStringList=stringToCamelize.split('-');var isFirstEntry=true;var camelizedString='';for(var i=0;i<oStringList.length;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
63 |
{if(oStringList[i].length>0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
64 |
{if(isFirstEntry) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
65 |
{camelizedString=oStringList[i];isFirstEntry=false;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
66 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
67 |
{var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
68 |
return camelizedString;};Spry.Effect.Utils.isPercentValue=function(value) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
69 |
{var result=false;if(typeof value=='string'&&value.length>0&&value.lastIndexOf("%")>0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
70 |
result=true;return result;};Spry.Effect.Utils.getPercentValue=function(value) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
71 |
{var result=0;try |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
72 |
{result=Number(value.substring(0,value.lastIndexOf("%")));} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
73 |
catch(e){Spry.Effect.Utils.showError('Spry.Effect.Utils.getPercentValue: '+e);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
74 |
return result;};Spry.Effect.Utils.getPixelValue=function(value) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
75 |
{var result=0;if(typeof value=='number')return value;var unitIndex=value.lastIndexOf("px");if(unitIndex==-1) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
76 |
unitIndex=value.length;try |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
77 |
{result=parseInt(value.substring(0,unitIndex),10);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
78 |
catch(e){} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
79 |
return result;};Spry.Effect.Utils.getFirstChildElement=function(node) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
80 |
{if(node) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
81 |
{var childCurr=node.firstChild;while(childCurr) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
82 |
{if(childCurr.nodeType==1) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
83 |
return childCurr;childCurr=childCurr.nextSibling;}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
84 |
return null;};Spry.Effect.Utils.fetchChildImages=function(startEltIn,targetImagesOut) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
85 |
{if(!startEltIn||startEltIn.nodeType!=1||!targetImagesOut) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
86 |
return;if(startEltIn.hasChildNodes()) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
87 |
{var childImages=startEltIn.getElementsByTagName('img');var imageCnt=childImages.length;for(var i=0;i<imageCnt;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
88 |
{var imgCurr=childImages[i];var dimensionsCurr=Spry.Effect.getDimensions(imgCurr);targetImagesOut.push([imgCurr,dimensionsCurr.width,dimensionsCurr.height]);}}};Spry.Effect.Utils.optionsAreIdentical=function(optionsA,optionsB) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
89 |
{if(optionsA==null&&optionsB==null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
90 |
return true;if(optionsA!=null&&optionsB!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
91 |
{var objectCountA=0;var objectCountB=0;for(var propA in optionsA)objectCountA++;for(var propB in optionsB)objectCountB++;if(objectCountA!=objectCountB) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
92 |
return false;for(var prop in optionsA) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
93 |
{var typeA=typeof optionsA[prop];var typeB=typeof optionsB[prop];if(typeA!=typeB||(typeA!='undefined'&&optionsA[prop]!=optionsB[prop])) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
94 |
return false;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
95 |
return true;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
96 |
return false;};Spry.Effect.Utils.DoEffect=function(effectName,element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
97 |
{if(!options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
98 |
var options={};options.name=effectName;var ef=SpryRegistry.getRegisteredEffect(element,options);if(!ef) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
99 |
{ef=new Spry.Effect[effectName](element,options);SpryRegistry.addEffect(ef,element,options);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
100 |
ef.start();return true;};if(!Spry.Utils)Spry.Utils={};Spry.Utils.Notifier=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
101 |
{this.observers=[];this.suppressNotifications=0;};Spry.Utils.Notifier.prototype.addObserver=function(observer) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
102 |
{if(!observer) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
103 |
return;var len=this.observers.length;for(var i=0;i<len;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
104 |
if(this.observers[i]==observer)return;this.observers[len]=observer;};Spry.Utils.Notifier.prototype.removeObserver=function(observer) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
105 |
{if(!observer) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
106 |
return;for(var i=0;i<this.observers.length;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
107 |
{if(this.observers[i]==observer) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
108 |
{this.observers.splice(i,1);break;}}};Spry.Utils.Notifier.prototype.notifyObservers=function(methodName,data) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
109 |
{if(!methodName) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
110 |
return;if(!this.suppressNotifications) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
111 |
{var len=this.observers.length;for(var i=0;i<len;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
112 |
{var obs=this.observers[i];if(obs) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
113 |
{if(typeof obs=="function") |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
114 |
obs(methodName,this,data);else if(obs[methodName]) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
115 |
obs[methodName](this,data);}}}};Spry.Utils.Notifier.prototype.enableNotifications=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
116 |
{if(--this.suppressNotifications<0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
117 |
{this.suppressNotifications=0;Spry.Effect.Utils.showError("Unbalanced enableNotifications() call!\n");}};Spry.Utils.Notifier.prototype.disableNotifications=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
118 |
{++this.suppressNotifications;};Spry.Effect.getElement=function(ele) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
119 |
{var element=ele;if(typeof ele=="string") |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
120 |
element=document.getElementById(ele);if(element==null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
121 |
Spry.Effect.Utils.showError('Element "'+ele+'" not found.');return element;};Spry.Effect.getStyleProp=function(element,prop) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
122 |
{var value;var camelized=Spry.Effect.Utils.camelize(prop);try |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
123 |
{if(element.style) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
124 |
value=element.style[camelized];if(!value) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
125 |
{if(document.defaultView&&document.defaultView.getComputedStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
126 |
{var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(prop):null;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
127 |
else if(element.currentStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
128 |
{value=element.currentStyle[camelized];}}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
129 |
catch(e){Spry.Effect.Utils.showError('Spry.Effect.getStyleProp: '+e);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
130 |
return value=='auto'?null:value;};Spry.Effect.setStyleProp=function(element,prop,value) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
131 |
{try |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
132 |
{element.style[Spry.Effect.Utils.camelize(prop)]=value;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
133 |
catch(e){Spry.Effect.Utils.showError('Spry.Effect.setStyleProp: '+e);}};Spry.Effect.getStylePropRegardlessOfDisplayState=function(element,prop,displayElement) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
134 |
{var refElement=displayElement?displayElement:element;var displayOrig=Spry.Effect.getStyleProp(refElement,'display');var visibilityOrig=Spry.Effect.getStyleProp(refElement,'visibility');if(displayOrig=='none') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
135 |
{Spry.Effect.setStyleProp(refElement,'visibility','hidden');Spry.Effect.setStyleProp(refElement,'display','block');if(window.opera) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
136 |
refElement.focus();} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
137 |
var styleProp=Spry.Effect.getStyleProp(element,prop);if(displayOrig=='none') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
138 |
{Spry.Effect.setStyleProp(refElement,'display','none');Spry.Effect.setStyleProp(refElement,'visibility',visibilityOrig);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
139 |
return styleProp;};Spry.Effect.makePositioned=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
140 |
{var pos=Spry.Effect.getStyleProp(element,'position');if(!pos||pos=='static') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
141 |
{element.style.position='relative';if(window.opera) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
142 |
{element.style.top=0;element.style.left=0;}}};Spry.Effect.isInvisible=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
143 |
{var propDisplay=Spry.Effect.getStyleProp(element,'display');if(propDisplay&&propDisplay.toLowerCase()=='none') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
144 |
return true;var propVisible=Spry.Effect.getStyleProp(element,'visibility');if(propVisible&&propVisible.toLowerCase()=='hidden') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
145 |
return true;return false;};Spry.Effect.enforceVisible=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
146 |
{var propDisplay=Spry.Effect.getStyleProp(element,'display');if(propDisplay&&propDisplay.toLowerCase()=='none') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
147 |
Spry.Effect.setStyleProp(element,'display','block');var propVisible=Spry.Effect.getStyleProp(element,'visibility');if(propVisible&&propVisible.toLowerCase()=='hidden') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
148 |
Spry.Effect.setStyleProp(element,'visibility','visible');};Spry.Effect.makeClipping=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
149 |
{var overflow=Spry.Effect.getStyleProp(element,'overflow');if(!overflow||(overflow.toLowerCase()!='hidden'&&overflow.toLowerCase()!='scroll')) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
150 |
{var heightCache=0;var needsCache=/MSIE 7.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent);if(needsCache) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
151 |
heightCache=Spry.Effect.getDimensionsRegardlessOfDisplayState(element).height;Spry.Effect.setStyleProp(element,'overflow','hidden');if(needsCache) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
152 |
Spry.Effect.setStyleProp(element,'height',heightCache+'px');}};Spry.Effect.cleanWhitespace=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
153 |
{var childCountInit=element.childNodes.length;for(var i=childCountInit-1;i>=0;i--){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
154 |
try |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
155 |
{element.removeChild(node);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
156 |
catch(e){Spry.Effect.Utils.showError('Spry.Effect.cleanWhitespace: '+e);}}};Spry.Effect.getComputedStyle=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
157 |
{return/MSIE/.test(navigator.userAgent)?element.currentStyle:document.defaultView.getComputedStyle(element,null);};Spry.Effect.getDimensions=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
158 |
{var dimensions=new Spry.Effect.Utils.Rectangle;var computedStyle=null;if(element.style.width&&/px/i.test(element.style.width)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
159 |
dimensions.width=parseInt(element.style.width,10);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
160 |
{computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.width&&/px/i.test(computedStyle.width);if(tryComputedStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
161 |
dimensions.width=parseInt(computedStyle.width,10);if(!tryComputedStyle||dimensions.width==0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
162 |
dimensions.width=element.offsetWidth;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
163 |
if(element.style.height&&/px/i.test(element.style.height)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
164 |
dimensions.height=parseInt(element.style.height,10);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
165 |
{if(!computedStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
166 |
computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.height&&/px/i.test(computedStyle.height);if(tryComputedStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
167 |
dimensions.height=parseInt(computedStyle.height,10);if(!tryComputedStyle||dimensions.height==0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
168 |
dimensions.height=element.offsetHeight;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
169 |
return dimensions;};Spry.Effect.getDimensionsRegardlessOfDisplayState=function(element,displayElement) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
170 |
{var refElement=displayElement?displayElement:element;var displayOrig=Spry.Effect.getStyleProp(refElement,'display');var visibilityOrig=Spry.Effect.getStyleProp(refElement,'visibility');if(displayOrig=='none') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
171 |
{Spry.Effect.setStyleProp(refElement,'visibility','hidden');Spry.Effect.setStyleProp(refElement,'display','block');if(window.opera) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
172 |
refElement.focus();} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
173 |
var dimensions=Spry.Effect.getDimensions(element);if(displayOrig=='none') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
174 |
{Spry.Effect.setStyleProp(refElement,'display','none');Spry.Effect.setStyleProp(refElement,'visibility',visibilityOrig);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
175 |
return dimensions;};Spry.Effect.getOpacity=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
176 |
{var o=Spry.Effect.getStyleProp(element,"opacity");if(typeof o=='undefined'||o==null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
177 |
o=1.0;return o;};Spry.Effect.getBgColor=function(ele) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
178 |
{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)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
179 |
return 0;return i;};Spry.Effect.getPosition=function(element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
180 |
{var position=new Spry.Effect.Utils.Position;var computedStyle=null;if(element.style.left&&/px/i.test(element.style.left)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
181 |
position.x=parseInt(element.style.left,10);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
182 |
{computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.left&&/px/i.test(computedStyle.left);if(tryComputedStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
183 |
position.x=parseInt(computedStyle.left,10);if(!tryComputedStyle||position.x==0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
184 |
position.x=element.offsetLeft;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
185 |
if(element.style.top&&/px/i.test(element.style.top)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
186 |
position.y=parseInt(element.style.top,10);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
187 |
{if(!computedStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
188 |
computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.top&&/px/i.test(computedStyle.top);if(tryComputedStyle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
189 |
position.y=parseInt(computedStyle.top,10);if(!tryComputedStyle||position.y==0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
190 |
position.y=element.offsetTop;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
191 |
return position;};Spry.Effect.getOffsetPosition=Spry.Effect.getPosition;Spry.Effect.Animator=function(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
192 |
{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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
193 |
var options={};if(options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
194 |
this.direction=false;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
195 |
this.direction=Spry.forwards;var self=this;if(options.setup!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
196 |
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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
197 |
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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
198 |
this.setTransition(options.transition);if(options.fps) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
199 |
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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
200 |
{if(!options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
201 |
return;for(var prop in options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
202 |
this.options[prop]=options[prop];};Spry.Effect.Animator.prototype.setTransition=function(transition){if(typeof transition=='number'||transition=="1"||transition=="2") |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
203 |
switch(parseInt(transition,10)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
204 |
{case 1:transition=Spry.linearTransition;break;case 2:transition=Spry.sinusoidalTransition;break;default:Spry.Effect.Utils.showError('unknown transition');} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
205 |
else if(typeof transition=='string') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
206 |
{if(typeof window[transition]=='function') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
207 |
transition=window[transition];else if(typeof Spry[transition]=='function') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
208 |
transition=Spry[transition];else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
209 |
Spry.Effect.Utils.showError('unknown transition');} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
210 |
this.options.transition=transition;if(typeof this.effectsArray!='undefined'){var l=this.effectsArray.length;for(var i=0;i<l;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
211 |
this.effectsArray[i].effect.setTransition(transition);}};Spry.Effect.Animator.prototype.setDuration=function(duration){this.options.duration=duration;if(typeof this.effectsArray!='undefined') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
212 |
{var l=this.effectsArray.length;for(var i=0;i<l;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
213 |
{this.effectsArray[i].effect.setDuration(duration);}}};Spry.Effect.Animator.prototype.setFps=function(fps){this.options.interval=parseInt(1000/fps,10);this.options.fps=fps;if(typeof this.effectsArray!='undefined') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
214 |
{var l=this.effectsArray.length;for(var i=0;i<l;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
215 |
{this.effectsArray[i].effect.setFps(fps);}}};Spry.Effect.Animator.prototype.start=function(withoutTimer) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
216 |
{if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
217 |
return;if(arguments.length==0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
218 |
withoutTimer=false;if(this.isRunning) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
219 |
this.cancel();this.prepareStart();var currDate=new Date();this.startMilliseconds=currDate.getTime();if(this.element.id) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
220 |
this.element=document.getElementById(this.element.id);if(this.cancelRemaining!=0&&this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
221 |
{if(this.cancelRemaining<1&&typeof this.options.transition=='function') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
222 |
{var startTime=0;var stopTime=this.options.duration;var start=0;var stop=1;var emergency=0;this.cancelRemaining=Math.round(this.cancelRemaining*1000)/1000;var found=false;var middle=0;while(!found) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
223 |
{if(emergency++>this.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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
224 |
{this.startMilliseconds-=half;found=true;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
225 |
if(middle<this.cancelRemaining) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
226 |
{stopTime=half;stop=middle;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
227 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
228 |
{startTime=half;start=middle;}}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
229 |
this.cancelRemaining=0;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
230 |
this.notifyObservers('onPreEffect',this);if(withoutTimer==false) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
231 |
{var self=this;this.timer=setInterval(function(){self.drawEffect();},this.options.interval);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
232 |
this.isRunning=true;};Spry.Effect.Animator.prototype.stopFlagReset=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
233 |
{if(this.timer) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
234 |
{clearInterval(this.timer);this.timer=null;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
235 |
this.startMilliseconds=0;};Spry.Effect.Animator.prototype.stop=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
236 |
{this.stopFlagReset();this.notifyObservers('onPostEffect',this);this.isRunning=false;};Spry.Effect.Animator.prototype.cancel=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
237 |
{var elapsed=this.getElapsedMilliseconds();if(this.startMilliseconds>0&&elapsed<this.options.duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
238 |
this.cancelRemaining=this.options.transition(elapsed,0,1,this.options.duration);this.stopFlagReset();this.notifyObservers('onCancel',this);this.isRunning=false;};Spry.Effect.Animator.prototype.drawEffect=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
239 |
{var isRunning=true;this.notifyObservers('onStep',this);var timeElapsed=this.getElapsedMilliseconds();if(typeof this.options.transition!='function'){Spry.Effect.Utils.showError('unknown transition');return;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
240 |
this.animate();if(timeElapsed>this.options.duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
241 |
{isRunning=false;this.stop();} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
242 |
return isRunning;};Spry.Effect.Animator.prototype.getElapsedMilliseconds=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
243 |
{if(this.startMilliseconds>0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
244 |
{var currDate=new Date();return(currDate.getTime()-this.startMilliseconds);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
245 |
return 0;};Spry.Effect.Animator.prototype.doToggle=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
246 |
{if(!this.direction) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
247 |
{this.direction=Spry.forwards;return;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
248 |
if(this.options.toggle==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
249 |
{if(this.direction==Spry.forwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
250 |
{this.direction=Spry.backwards;this.notifyObservers('onToggle',this);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
251 |
else if(this.direction==Spry.backwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
252 |
{this.direction=Spry.forwards;}}};Spry.Effect.Animator.prototype.prepareStart=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
253 |
{if(this.options&&this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
254 |
this.doToggle();};Spry.Effect.Animator.prototype.animate=function(){};Spry.Effect.Animator.prototype.onStep=function(el) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
255 |
{if(el!=this) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
256 |
this.notifyObservers('onStep',this);};Spry.Effect.Move=function(element,fromPos,toPos,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
257 |
{this.dynamicFromPos=false;if(arguments.length==3) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
258 |
{options=toPos;toPos=fromPos;fromPos=Spry.Effect.getPosition(element);this.dynamicFromPos=true;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
259 |
Spry.Effect.Animator.call(this,options);this.name='Move';this.element=Spry.Effect.getElement(element);if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
260 |
return;if(fromPos.units!=toPos.units) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
261 |
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() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
262 |
{var left=0;var top=0;var floor=Math.floor;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
263 |
{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));} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
264 |
else if(this.direction==Spry.backwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
265 |
{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));} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
266 |
this.element.style.left=left+this.units;this.element.style.top=top+this.units;};Spry.Effect.Move.prototype.prepareStart=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
267 |
{if(this.options&&this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
268 |
this.doToggle();if(this.dynamicFromPos==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
269 |
{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) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
270 |
{this.dynamicFromRect=false;if(arguments.length==3) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
271 |
{options=toRect;toRect=fromRect;fromRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);this.dynamicFromRect=true;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
272 |
Spry.Effect.Animator.call(this,options);this.name='Size';this.element=Spry.Effect.getElement(element);if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
273 |
return;element=this.element;if(fromRect.units!=toRect.units) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
274 |
{Spry.Effect.Utils.showError('Spry.Effect.Size: Conflicting units ('+fromRect.units+', '+toRect.units+')');return false;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
275 |
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');} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
276 |
if(this.options.scaleContent) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
277 |
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)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
278 |
this.fontFactor=parseFloat(fontSize);var isPercent=Spry.Effect.Utils.isPercentValue;if(isPercent(this.startWidth)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
279 |
{var startWidthPercent=Spry.Effect.Utils.getPercentValue(this.startWidth);this.startWidth=originalRect.width*(startWidthPercent/100);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
280 |
if(isPercent(this.startHeight)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
281 |
{var startHeightPercent=Spry.Effect.Utils.getPercentValue(this.startHeight);this.startHeight=originalRect.height*(startHeightPercent/100);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
282 |
if(isPercent(this.stopWidth)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
283 |
{var stopWidthPercent=Spry.Effect.Utils.getPercentValue(this.stopWidth);this.stopWidth=originalRect.width*(stopWidthPercent/100);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
284 |
if(isPercent(this.stopHeight)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
285 |
{var stopHeightPercent=Spry.Effect.Utils.getPercentValue(this.stopHeight);this.stopHeight=originalRect.height*(stopHeightPercent/100);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
286 |
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() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
287 |
{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;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
288 |
var propFactor=width/this.originalWidth;fontSize=this.fontFactor*propFactor;var elStyle=this.element.style;if(width<0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
289 |
width=0;if(height<0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
290 |
height=0;elStyle.width=width+this.units;elStyle.height=height+this.units;if(typeof this.options.useCSSBox!='undefined'&&this.options.useCSSBox==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
291 |
{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;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
292 |
if(this.options.scaleContent) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
293 |
{for(var i=0;i<this.childImages.length;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
294 |
{this.childImages[i][0].style.width=propFactor*this.childImages[i][1]+this.units;this.childImages[i][0].style.height=propFactor*this.childImages[i][2]+this.units;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
295 |
this.element.style.fontSize=fontSize+'em';} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
296 |
if(this.enforceVisible) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
297 |
{Spry.Effect.enforceVisible(this.element);this.enforceVisible=false;}};Spry.Effect.Size.prototype.prepareStart=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
298 |
{if(this.options&&this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
299 |
this.doToggle();if(this.dynamicFromRect==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
300 |
{var fromRect=Spry.Effect.getDimensions(this.element);this.startWidth=fromRect.width;this.startHeight=fromRect.height;this.widthRange=this.startWidth-this.stopWidth;this.heightRange=this.startHeight-this.stopHeight;}};Spry.Effect.Opacity=function(element,startOpacity,stopOpacity,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
301 |
{this.dynamicStartOpacity=false;if(arguments.length==3) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
302 |
{options=stopOpacity;stopOpacity=startOpacity;startOpacity=Spry.Effect.getOpacity(element);this.dynamicStartOpacity=true;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
303 |
Spry.Effect.Animator.call(this,options);this.name='Opacity';this.element=Spry.Effect.getElement(element);if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
304 |
return;if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
305 |
Spry.Effect.setStyleProp(this.element,'zoom','1');this.startOpacity=startOpacity;this.stopOpacity=stopOpacity;this.enforceVisible=Spry.Effect.isInvisible(this.element);};Spry.Effect.Opacity.prototype=new Spry.Effect.Animator();Spry.Effect.Opacity.prototype.constructor=Spry.Effect.Opacity;Spry.Effect.Opacity.prototype.animate=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
306 |
{var opacity=0;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
307 |
opacity=this.options.transition(elapsed,this.startOpacity,this.stopOpacity-this.startOpacity,this.options.duration);else if(this.direction==Spry.backwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
308 |
opacity=this.options.transition(elapsed,this.stopOpacity,this.startOpacity-this.stopOpacity,this.options.duration);if(opacity<0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
309 |
opacity=0;if(/MSIE/.test(navigator.userAgent)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
310 |
{var tmpval=Spry.Effect.getStyleProp(this.element,'filter');if(tmpval){tmpval=tmpval.replace(/alpha\(opacity=[0-9]{1,3}\)/g,'');} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
311 |
this.element.style.filter=tmpval+"alpha(opacity="+Math.floor(opacity*100)+")";} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
312 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
313 |
this.element.style.opacity=opacity;if(this.enforceVisible) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
314 |
{Spry.Effect.enforceVisible(this.element);this.enforceVisible=false;}};Spry.Effect.Opacity.prototype.prepareStart=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
315 |
{if(this.options&&this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
316 |
this.doToggle();if(this.dynamicStartOpacity==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
317 |
{this.startOpacity=Spry.Effect.getOpacity(this.element);this.opacityRange=this.startOpacity-this.stopOpacity;}};Spry.Effect.Color=function(element,startColor,stopColor,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
318 |
{this.dynamicStartColor=false;if(arguments.length==3) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
319 |
{options=stopColor;stopColor=startColor;startColor=Spry.Effect.getBgColor(element);this.dynamicStartColor=true;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
320 |
Spry.Effect.Animator.call(this,options);this.name='Color';this.element=Spry.Effect.getElement(element);if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
321 |
return;this.startColor=startColor;this.stopColor=stopColor;this.startRedColor=Spry.Effect.Utils.hexToInt(startColor.substr(1,2));this.startGreenColor=Spry.Effect.Utils.hexToInt(startColor.substr(3,2));this.startBlueColor=Spry.Effect.Utils.hexToInt(startColor.substr(5,2));this.stopRedColor=Spry.Effect.Utils.hexToInt(stopColor.substr(1,2));this.stopGreenColor=Spry.Effect.Utils.hexToInt(stopColor.substr(3,2));this.stopBlueColor=Spry.Effect.Utils.hexToInt(stopColor.substr(5,2));};Spry.Effect.Color.prototype=new Spry.Effect.Animator();Spry.Effect.Color.prototype.constructor=Spry.Effect.Color;Spry.Effect.Color.prototype.animate=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
322 |
{var redColor=0;var greenColor=0;var blueColor=0;var floor=Math.floor;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
323 |
{redColor=floor(this.options.transition(elapsed,this.startRedColor,this.stopRedColor-this.startRedColor,this.options.duration));greenColor=floor(this.options.transition(elapsed,this.startGreenColor,this.stopGreenColor-this.startGreenColor,this.options.duration));blueColor=floor(this.options.transition(elapsed,this.startBlueColor,this.stopBlueColor-this.startBlueColor,this.options.duration));} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
324 |
else if(this.direction==Spry.backwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
325 |
{redColor=floor(this.options.transition(elapsed,this.stopRedColor,this.startRedColor-this.stopRedColor,this.options.duration));greenColor=floor(this.options.transition(elapsed,this.stopGreenColor,this.startGreenColor-this.stopGreenColor,this.options.duration));blueColor=floor(this.options.transition(elapsed,this.stopBlueColor,this.startBlueColor-this.stopBlueColor,this.options.duration));} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
326 |
this.element.style.backgroundColor=Spry.Effect.Utils.rgb(redColor,greenColor,blueColor);};Spry.Effect.Color.prototype.prepareStart=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
327 |
{if(this.options&&this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
328 |
this.doToggle();if(this.dynamicStartColor==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
329 |
{this.startColor=Spry.Effect.getBgColor(element);this.startRedColor=Spry.Effect.Utils.hexToInt(startColor.substr(1,2));this.startGreenColor=Spry.Effect.Utils.hexToInt(startColor.substr(3,2));this.startBlueColor=Spry.Effect.Utils.hexToInt(startColor.substr(5,2));this.redColorRange=this.startRedColor-this.stopRedColor;this.greenColorRange=this.startGreenColor-this.stopGreenColor;this.blueColorRange=this.startBlueColor-this.stopBlueColor;}};Spry.Effect.Cluster=function(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
330 |
{Spry.Effect.Animator.call(this,options);this.name='Cluster';this.effectsArray=new Array();this.currIdx=-1;var _ClusteredEffect=function(effect,kind) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
331 |
{this.effect=effect;this.kind=kind;this.isRunning=false;};this.ClusteredEffect=_ClusteredEffect;};Spry.Effect.Cluster.prototype=new Spry.Effect.Animator();Spry.Effect.Cluster.prototype.constructor=Spry.Effect.Cluster;Spry.Effect.Cluster.prototype.setInterval=function(interval){var l=this.effectsArray.length;this.options.interval=interval;for(var i=0;i<l;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
332 |
{this.effectsArray[i].effect.setInterval(interval);}};Spry.Effect.Cluster.prototype.drawEffect=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
333 |
{var isRunning=true;var allEffectsDidRun=false;var baseEffectIsStillRunning=false;var evalNextEffectsRunning=false;if((this.currIdx==-1&&this.direction==Spry.forwards)||(this.currIdx==this.effectsArray.length&&this.direction==Spry.backwards)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
334 |
this.initNextEffectsRunning();var start=this.direction==Spry.forwards?0:this.effectsArray.length-1;var stop=this.direction==Spry.forwards?this.effectsArray.length:-1;var step=this.direction==Spry.forwards?1:-1;for(var i=start;i!=stop;i+=step) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
335 |
{if(this.effectsArray[i].isRunning==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
336 |
{baseEffectIsStillRunning=this.effectsArray[i].effect.drawEffect();if(baseEffectIsStillRunning==false&&i==this.currIdx) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
337 |
{this.effectsArray[i].isRunning=false;evalNextEffectsRunning=true;}}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
338 |
if(evalNextEffectsRunning==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
339 |
allEffectsDidRun=this.initNextEffectsRunning();if(allEffectsDidRun==true){this.stop();isRunning=false;for(var i=0;i<this.effectsArray.length;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
340 |
this.effectsArray[i].isRunning=false;this.currIdx=this.direction==Spry.forwards?this.effectsArray.length:-1;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
341 |
return isRunning;};Spry.Effect.Cluster.prototype.initNextEffectsRunning=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
342 |
{var allEffectsDidRun=false;var step=this.direction==Spry.forwards?1:-1;var stop=this.direction==Spry.forwards?this.effectsArray.length:-1;this.currIdx+=step;if((this.currIdx>(this.effectsArray.length-1)&&this.direction==Spry.forwards)||(this.currIdx<0&&this.direction==Spry.backwards)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
343 |
allEffectsDidRun=true;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
344 |
for(var i=this.currIdx;i!=stop;i+=step) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
345 |
{if((i>this.currIdx&&this.direction==Spry.forwards||i<this.currIdx&&this.direction==Spry.backwards)&&this.effectsArray[i].kind=="queue") |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
346 |
break;this.effectsArray[i].effect.start(true);this.effectsArray[i].isRunning=true;this.currIdx=i;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
347 |
return allEffectsDidRun;};Spry.Effect.Cluster.prototype.toggleCluster=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
348 |
{if(!this.direction) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
349 |
{this.direction=Spry.forwards;return;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
350 |
if(this.options.toggle==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
351 |
{if(this.direction==Spry.forwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
352 |
{this.direction=Spry.backwards;this.notifyObservers('onToggle',this);this.currIdx=this.effectsArray.length;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
353 |
else if(this.direction==Spry.backwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
354 |
{this.direction=Spry.forwards;this.currIdx=-1;}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
355 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
356 |
{if(this.direction==Spry.forwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
357 |
this.currIdx=-1;else if(this.direction==Spry.backwards) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
358 |
this.currIdx=this.effectsArray.length;}};Spry.Effect.Cluster.prototype.doToggle=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
359 |
{this.toggleCluster();for(var i=0;i<this.effectsArray.length;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
360 |
{if(this.effectsArray[i].effect.options&&(this.effectsArray[i].effect.options.toggle!=null)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
361 |
if(this.effectsArray[i].effect.options.toggle==true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
362 |
this.effectsArray[i].effect.doToggle();}};Spry.Effect.Cluster.prototype.cancel=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
363 |
{for(var i=0;i<this.effectsArray.length;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
364 |
if(this.effectsArray[i].effect.isRunning) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
365 |
this.effectsArray[i].effect.cancel();var elapsed=this.getElapsedMilliseconds();if(this.startMilliseconds>0&&elapsed<this.options.duration) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
366 |
this.cancelRemaining=this.options.transition(elapsed,0,1,this.options.duration);this.stopFlagReset();this.notifyObservers('onCancel',this);this.isRunning=false;};Spry.Effect.Cluster.prototype.addNextEffect=function(effect) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
367 |
{effect.addObserver(this);this.effectsArray[this.effectsArray.length]=new this.ClusteredEffect(effect,"queue");if(this.effectsArray.length==1) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
368 |
{this.element=effect.element;}};Spry.Effect.Cluster.prototype.addParallelEffect=function(effect) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
369 |
{if(this.effectsArray.length==0||this.effectsArray[this.effectsArray.length-1].kind!='parallel') |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
370 |
effect.addObserver(this);this.effectsArray[this.effectsArray.length]=new this.ClusteredEffect(effect,"parallel");if(this.effectsArray.length==1) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
371 |
{this.element=effect.element;}};Spry.Effect.Cluster.prototype.prepareStart=function() |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
372 |
{this.toggleCluster();};Spry.Effect.Fade=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
373 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
374 |
return Spry.Effect.Utils.showInitError('Fade');Spry.Effect.Cluster.call(this,options);this.name='Fade';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
375 |
return;var durationInMilliseconds=1000;var fromOpacity=0.0;var toOpacity=100.0;var doToggle=false;var transition=Spry.fifthTransition;var fps=60;var originalOpacity=0;if(/MSIE/.test(navigator.userAgent)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
376 |
originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'filter').replace(/alpha\(opacity=([0-9]{1,3})\)/g,'$1'),10);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
377 |
originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'opacity')*100,10);if(isNaN(originalOpacity)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
378 |
originalOpacity=100;if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
379 |
{if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null){if(Spry.Effect.Utils.isPercentValue(options.from)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
380 |
fromOpacity=Spry.Effect.Utils.getPercentValue(options.from)*originalOpacity/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
381 |
fromOpacity=options.from;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
382 |
if(options.to!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
383 |
{if(Spry.Effect.Utils.isPercentValue(options.to)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
384 |
toOpacity=Spry.Effect.Utils.getPercentValue(options.to)*originalOpacity/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
385 |
toOpacity=options.to;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
386 |
if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)transition=options.transition;if(options.fps!=null)fps=options.fps;else this.options.transition=transition;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
387 |
fromOpacity=fromOpacity/100.0;toOpacity=toOpacity/100.0;options={duration:durationInMilliseconds,toggle:doToggle,transition:transition,from:fromOpacity,to:toOpacity,fps:fps};var fadeEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);this.addNextEffect(fadeEffect);};Spry.Effect.Fade.prototype=new Spry.Effect.Cluster();Spry.Effect.Fade.prototype.constructor=Spry.Effect.Fade;Spry.Effect.Blind=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
388 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
389 |
return Spry.Effect.Utils.showInitError('Blind');Spry.Effect.Cluster.call(this,options);this.name='Blind';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
390 |
return;var durationInMilliseconds=1000;var doToggle=false;var kindOfTransition=Spry.circleTransition;var fps=60;var doScaleContent=false;Spry.Effect.makeClipping(element);var originalRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var fromHeightPx=originalRect.height;var toHeightPx=0;var optionFrom=options?options.from:originalRect.height;var optionTo=options?options.to:0;var fullCSSBox=false;if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
391 |
{if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
392 |
{if(Spry.Effect.Utils.isPercentValue(options.from)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
393 |
fromHeightPx=Spry.Effect.Utils.getPercentValue(options.from)*originalRect.height/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
394 |
fromHeightPx=Spry.Effect.Utils.getPixelValue(options.from);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
395 |
if(options.to!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
396 |
{if(Spry.Effect.Utils.isPercentValue(options.to)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
397 |
toHeightPx=Spry.Effect.Utils.getPercentValue(options.to)*originalRect.height/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
398 |
toHeightPx=Spry.Effect.Utils.getPixelValue(options.to);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
399 |
if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;if(options.useCSSBox!=null)fullCSSBox=options.useCSSBox;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
400 |
var fromRect=new Spry.Effect.Utils.Rectangle;fromRect.width=originalRect.width;fromRect.height=fromHeightPx;var toRect=new Spry.Effect.Utils.Rectangle;toRect.width=originalRect.width;toRect.height=toHeightPx;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,scaleContent:doScaleContent,useCSSBox:fullCSSBox,from:optionFrom,to:optionTo,fps:fps};var blindEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addNextEffect(blindEffect);};Spry.Effect.Blind.prototype=new Spry.Effect.Cluster();Spry.Effect.Blind.prototype.constructor=Spry.Effect.Blind;Spry.Effect.Highlight=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
401 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
402 |
return Spry.Effect.Utils.showInitError('Highlight');Spry.Effect.Cluster.call(this,options);this.name='Highlight';var durationInMilliseconds=1000;var toColor="#ffffff";var doToggle=false;var kindOfTransition=Spry.sinusoidalTransition;var fps=60;var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
403 |
return;var fromColor=Spry.Effect.getBgColor(element);if(fromColor=="transparent")fromColor="#ffff99";if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
404 |
{if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null)fromColor=options.from;if(options.to!=null)toColor=options.to;if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
405 |
if(fromColor.indexOf('rgb')!=-1) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
406 |
var fromColor=Spry.Effect.Utils.rgb(parseInt(fromColor.substring(fromColor.indexOf('(')+1,fromColor.indexOf(',')),10),parseInt(fromColor.substring(fromColor.indexOf(',')+1,fromColor.lastIndexOf(',')),10),parseInt(fromColor.substring(fromColor.lastIndexOf(',')+1,fromColor.indexOf(')')),10));if(toColor.indexOf('rgb')!=-1) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
407 |
var toColor=Spry.Effect.Utils.rgb(parseInt(toColor.substring(toColor.indexOf('(')+1,toColor.indexOf(',')),10),parseInt(toColor.substring(toColor.indexOf(',')+1,toColor.lastIndexOf(',')),10),parseInt(toColor.substring(toColor.lastIndexOf(',')+1,toColor.indexOf(')')),10));var fromColor=Spry.Effect.Utils.longColorVersion(fromColor);var toColor=Spry.Effect.Utils.longColorVersion(toColor);this.restoreBackgroundImage=Spry.Effect.getStyleProp(element,'background-image');options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var highlightEffect=new Spry.Effect.Color(element,fromColor,toColor,options);this.addNextEffect(highlightEffect);this.addObserver({onPreEffect:function(effect){Spry.Effect.setStyleProp(effect.element,'background-image','none');},onPostEffect:function(effect){Spry.Effect.setStyleProp(effect.element,'background-image',effect.restoreBackgroundImage);if(effect.direction==Spry.forwards&&effect.options.restoreColor) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
408 |
Spry.Effect.setStyleProp(element,'background-color',effect.options.restoreColor);}});};Spry.Effect.Highlight.prototype=new Spry.Effect.Cluster();Spry.Effect.Highlight.prototype.constructor=Spry.Effect.Highlight;Spry.Effect.Slide=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
409 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
410 |
return Spry.Effect.Utils.showInitError('Slide');Spry.Effect.Cluster.call(this,options);this.name='Slide';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
411 |
return;var durationInMilliseconds=1000;var doToggle=false;var kindOfTransition=Spry.sinusoidalTransition;var fps=60;var slideHorizontally=false;var firstChildElt=Spry.Effect.Utils.getFirstChildElement(element);var direction=-1;if(/MSIE 7.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
412 |
Spry.Effect.makePositioned(element);Spry.Effect.makeClipping(element);if(/MSIE 6.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
413 |
{var pos=Spry.Effect.getStyleProp(element,'position');if(pos&&(pos=='static'||pos=='fixed')) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
414 |
{Spry.Effect.setStyleProp(element,'position','relative');Spry.Effect.setStyleProp(element,'top','');Spry.Effect.setStyleProp(element,'left','');}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
415 |
if(firstChildElt) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
416 |
{Spry.Effect.makePositioned(firstChildElt);Spry.Effect.makeClipping(firstChildElt);var childRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(firstChildElt,element);Spry.Effect.setStyleProp(firstChildElt,'width',childRect.width+'px');} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
417 |
var fromDim=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var initDim=new Spry.Effect.Utils.Rectangle();var toDim=new Spry.Effect.Utils.Rectangle();initDim.width=toDim.width=fromDim.width;initDim.height=toDim.height=fromDim.height;if(!this.options.to){if(!options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
418 |
options={};options.to='0%';} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
419 |
if(options&&options.horizontal!==null&&options.horizontal===true) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
420 |
slideHorizontally=true;if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
421 |
{if(slideHorizontally) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
422 |
{if(Spry.Effect.Utils.isPercentValue(options.from)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
423 |
fromDim.width=initDim.width*Spry.Effect.Utils.getPercentValue(options.from)/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
424 |
fromDim.width=Spry.Effect.Utils.getPixelValue(options.from);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
425 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
426 |
{if(Spry.Effect.Utils.isPercentValue(options.from)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
427 |
fromDim.height=initDim.height*Spry.Effect.Utils.getPercentValue(options.from)/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
428 |
fromDim.height=Spry.Effect.Utils.getPixelValue(options.from);}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
429 |
if(options.to!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
430 |
{if(slideHorizontally) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
431 |
{if(Spry.Effect.Utils.isPercentValue(options.to)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
432 |
toDim.width=initDim.width*Spry.Effect.Utils.getPercentValue(options.to)/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
433 |
toDim.width=Spry.Effect.Utils.getPixelValue(options.to);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
434 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
435 |
{if(Spry.Effect.Utils.isPercentValue(options.to)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
436 |
toDim.height=initDim.height*Spry.Effect.Utils.getPercentValue(options.to)/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
437 |
toDim.height=Spry.Effect.Utils.getPixelValue(options.to);}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
438 |
if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;options={duration:durationInMilliseconds,transition:kindOfTransition,scaleContent:false,toggle:doToggle,fps:fps};var size=new Spry.Effect.Size(element,fromDim,toDim,options);this.addParallelEffect(size);if((fromDim.width<toDim.width&&slideHorizontally)||(fromDim.height<toDim.height&&!slideHorizontally)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
439 |
direction=1;var fromPos=new Spry.Effect.Utils.Position();var toPos=new Spry.Effect.Utils.Position();toPos.x=fromPos.x=Spry.Effect.intPropStyle(firstChildElt,'left');toPos.y=fromPos.y=Spry.Effect.intPropStyle(firstChildElt,'top');toPos.units=fromPos.units;if(slideHorizontally) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
440 |
toPos.x=parseInt(fromPos.x+direction*(fromDim.width-toDim.width),10);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
441 |
toPos.y=parseInt(fromPos.y+direction*(fromDim.height-toDim.height),10);if(direction==1){var tmp=fromPos;var fromPos=toPos;var toPos=tmp;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
442 |
options={duration:durationInMilliseconds,transition:kindOfTransition,toggle:doToggle,from:fromPos,to:toPos,fps:fps};var move=new Spry.Effect.Move(firstChildElt,fromPos,toPos,options);this.addParallelEffect(move);};Spry.Effect.Slide.prototype=new Spry.Effect.Cluster();Spry.Effect.Slide.prototype.constructor=Spry.Effect.Slide;Spry.Effect.Grow=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
443 |
{if(!element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
444 |
return;if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
445 |
return Spry.Effect.Utils.showInitError('Grow');Spry.Effect.Cluster.call(this,options);this.name='Grow';var durationInMilliseconds=1000;var doToggle=false;var doScaleContent=true;var calcHeight=false;var growFromCenter=true;var fullCSSBox=false;var kindOfTransition=Spry.squareTransition;var fps=60;var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
446 |
return;Spry.Effect.makeClipping(element);var dimRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var originalWidth=dimRect.width;var originalHeight=dimRect.height;var propFactor=(originalWidth==0)?1:originalHeight/originalWidth;var fromRect=new Spry.Effect.Utils.Rectangle;fromRect.width=0;fromRect.height=0;var toRect=new Spry.Effect.Utils.Rectangle;toRect.width=originalWidth;toRect.height=originalHeight;var optionFrom=options?options.from:dimRect.width;var optionTo=options?options.to:0;var pixelValue=Spry.Effect.Utils.getPixelValue;if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
447 |
{if(options.growCenter!=null)growFromCenter=options.growCenter;if(options.duration!=null)durationInMilliseconds=options.duration;if(options.useCSSBox!=null)fullCSSBox=options.useCSSBox;if(options.scaleContent!=null)doScaleContent=options.scaleContent;if(options.from!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
448 |
{if(Spry.Effect.Utils.isPercentValue(options.from)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
449 |
{fromRect.width=originalWidth*(Spry.Effect.Utils.getPercentValue(options.from)/100);fromRect.height=originalHeight*(Spry.Effect.Utils.getPercentValue(options.from)/100);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
450 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
451 |
{if(calcHeight) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
452 |
{fromRect.height=pixelValue(options.from);fromRect.width=pixelValue(options.from)/propFactor;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
453 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
454 |
{fromRect.width=pixelValue(options.from);fromRect.height=propFactor*pixelValue(options.from);}}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
455 |
if(options.to!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
456 |
{if(Spry.Effect.Utils.isPercentValue(options.to)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
457 |
{toRect.width=originalWidth*(Spry.Effect.Utils.getPercentValue(options.to)/100);toRect.height=originalHeight*(Spry.Effect.Utils.getPercentValue(options.to)/100);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
458 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
459 |
{if(calcHeight) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
460 |
{toRect.height=pixelValue(options.to);toRect.width=pixelValue(options.to)/propFactor;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
461 |
else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
462 |
{toRect.width=pixelValue(options.to);toRect.height=propFactor*pixelValue(options.to);}}} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
463 |
if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
464 |
options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,scaleContent:doScaleContent,useCSSBox:fullCSSBox,fps:fps};var sizeEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addParallelEffect(sizeEffect);if(growFromCenter) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
465 |
{Spry.Effect.makePositioned(element);var startOffsetPosition=new Spry.Effect.Utils.Position();startOffsetPosition.x=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(element,"left"),10);startOffsetPosition.y=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(element,"top"),10);if(!startOffsetPosition.x)startOffsetPosition.x=0;if(!startOffsetPosition.y)startOffsetPosition.y=0;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,from:optionFrom,to:optionTo,fps:fps};var fromPos=new Spry.Effect.Utils.Position;fromPos.x=startOffsetPosition.x+(originalWidth-fromRect.width)/2.0;fromPos.y=startOffsetPosition.y+(originalHeight-fromRect.height)/2.0;var toPos=new Spry.Effect.Utils.Position;toPos.x=startOffsetPosition.x+(originalWidth-toRect.width)/2.0;toPos.y=startOffsetPosition.y+(originalHeight-toRect.height)/2.0;var moveEffect=new Spry.Effect.Move(element,fromPos,toPos,options);this.addParallelEffect(moveEffect);}};Spry.Effect.Grow.prototype=new Spry.Effect.Cluster();Spry.Effect.Grow.prototype.constructor=Spry.Effect.Grow;Spry.Effect.Shake=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
466 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
467 |
return Spry.Effect.Utils.showInitError('Shake');Spry.Effect.Cluster.call(this,options);this.options.direction=false;if(this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
468 |
this.options.toggle=false;this.name='Shake';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
469 |
return;var durationInMilliseconds=100;var kindOfTransition=Spry.linearTransition;var fps=60;var steps=4;if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
470 |
{if(options.duration!=null)steps=Math.ceil(this.options.duration/durationInMilliseconds)-1;if(options.fps!=null)fps=options.fps;if(options.transition!=null)kindOfTransition=options.transition;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
471 |
Spry.Effect.makePositioned(element);var startOffsetPosition=new Spry.Effect.Utils.Position();startOffsetPosition.x=parseInt(Spry.Effect.getStyleProp(element,"left"),10);startOffsetPosition.y=parseInt(Spry.Effect.getStyleProp(element,"top"),10);if(!startOffsetPosition.x)startOffsetPosition.x=0;if(!startOffsetPosition.y)startOffsetPosition.y=0;var centerPos=new Spry.Effect.Utils.Position;centerPos.x=startOffsetPosition.x;centerPos.y=startOffsetPosition.y;var rightPos=new Spry.Effect.Utils.Position;rightPos.x=startOffsetPosition.x+20;rightPos.y=startOffsetPosition.y+0;var leftPos=new Spry.Effect.Utils.Position;leftPos.x=startOffsetPosition.x+-20;leftPos.y=startOffsetPosition.y+0;options={duration:Math.ceil(durationInMilliseconds/2),toggle:false,fps:fps,transition:kindOfTransition};var effect=new Spry.Effect.Move(element,centerPos,rightPos,options);this.addNextEffect(effect);options={duration:durationInMilliseconds,toggle:false,fps:fps,transition:kindOfTransition};var effectToRight=new Spry.Effect.Move(element,rightPos,leftPos,options);var effectToLeft=new Spry.Effect.Move(element,leftPos,rightPos,options);for(var i=0;i<steps;i++) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
472 |
{if(i%2==0) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
473 |
this.addNextEffect(effectToRight);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
474 |
this.addNextEffect(effectToLeft);} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
475 |
var pos=(steps%2==0)?rightPos:leftPos;options={duration:Math.ceil(durationInMilliseconds/2),toggle:false,fps:fps,transition:kindOfTransition};var effect=new Spry.Effect.Move(element,pos,centerPos,options);this.addNextEffect(effect);};Spry.Effect.Shake.prototype=new Spry.Effect.Cluster();Spry.Effect.Shake.prototype.constructor=Spry.Effect.Shake;Spry.Effect.Shake.prototype.doToggle=function(){};Spry.Effect.Squish=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
476 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
477 |
return Spry.Effect.Utils.showInitError('Squish');if(!options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
478 |
options={};if(!options.to) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
479 |
options.to='0%';if(!options.from) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
480 |
options.from='100%';options.growCenter=false;Spry.Effect.Grow.call(this,element,options);this.name='Squish';};Spry.Effect.Squish.prototype=new Spry.Effect.Grow();Spry.Effect.Squish.prototype.constructor=Spry.Effect.Squish;Spry.Effect.Pulsate=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
481 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
482 |
return Spry.Effect.Utils.showInitError('Pulsate');Spry.Effect.Cluster.call(this,options);this.options.direction=false;if(this.options.toggle) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
483 |
this.options.toggle=false;var element=Spry.Effect.getElement(element);var originalOpacity=0;this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
484 |
return;this.name='Pulsate';var durationInMilliseconds=100;var fromOpacity=100.0;var toOpacity=0.0;var doToggle=false;var kindOfTransition=Spry.linearTransition;var fps=60;if(/MSIE/.test(navigator.userAgent)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
485 |
originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'filter').replace(/alpha\(opacity=([0-9]{1,3})\)/g,'$1'),10);else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
486 |
originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'opacity')*100,10);if(isNaN(originalOpacity)){originalOpacity=100;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
487 |
if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
488 |
{if(options.from!=null){if(Spry.Effect.Utils.isPercentValue(options.from)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
489 |
fromOpacity=Spry.Effect.Utils.getPercentValue(options.from)*originalOpacity/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
490 |
fromOpacity=options.from;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
491 |
if(options.to!=null) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
492 |
{if(Spry.Effect.Utils.isPercentValue(options.to)) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
493 |
toOpacity=Spry.Effect.Utils.getPercentValue(options.to)*originalOpacity/100;else |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
494 |
toOpacity=options.to;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
495 |
if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
496 |
options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};fromOpacity=fromOpacity/100.0;toOpacity=toOpacity/100.0;var fadeEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);var appearEffect=new Spry.Effect.Opacity(element,toOpacity,fromOpacity,options);var steps=parseInt(this.options.duration/200,10);for(var i=0;i<steps;i++){this.addNextEffect(fadeEffect);this.addNextEffect(appearEffect);}};Spry.Effect.Pulsate.prototype=new Spry.Effect.Cluster();Spry.Effect.Pulsate.prototype.constructor=Spry.Effect.Pulsate;Spry.Effect.Pulsate.prototype.doToggle=function(){};Spry.Effect.Puff=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
497 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
498 |
return Spry.Effect.Utils.showInitError('Puff');Spry.Effect.Cluster.call(this,options);var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
499 |
return;this.name='Puff';var doToggle=false;var doScaleContent=false;var durationInMilliseconds=1000;var kindOfTransition=Spry.fifthTransition;var fps=60;Spry.Effect.makePositioned(element);if(options){if(options.toggle!=null)doToggle=options.toggle;if(options.duration!=null)durationInMilliseconds=options.duration;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
500 |
var originalRect=Spry.Effect.getDimensions(element);var startWidth=originalRect.width;var startHeight=originalRect.height;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var fromOpacity=1.0;var toOpacity=0.0;var opacityEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);this.addParallelEffect(opacityEffect);var fromPos=Spry.Effect.getPosition(element);var toPos=new Spry.Effect.Utils.Position;toPos.x=startWidth/2.0*-1.0;toPos.y=startHeight/2.0*-1.0;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,from:fromPos,to:toPos,fps:fps};var moveEffect=new Spry.Effect.Move(element,fromPos,toPos,options);this.addParallelEffect(moveEffect);var self=this;this.addObserver({onPreEffect:function(){if(self.direction==Spry.backwards){self.element.style.display='block';}},onPostEffect:function(){if(self.direction==Spry.forwards){self.element.style.display='none';}}});};Spry.Effect.Puff.prototype=new Spry.Effect.Cluster;Spry.Effect.Puff.prototype.constructor=Spry.Effect.Puff;Spry.Effect.DropOut=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
501 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
502 |
return Spry.Effect.Utils.showInitError('DropOut');Spry.Effect.Cluster.call(this,options);var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
503 |
return;var durationInMilliseconds=1000;var fps=60;var kindOfTransition=Spry.fifthTransition;var direction=Spry.forwards;var doToggle=false;this.name='DropOut';Spry.Effect.makePositioned(element);if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
504 |
{if(options.duration!=null)durationInMilliseconds=options.duration;if(options.toggle!=null)doToggle=options.toggle;if(options.fps!=null)fps=options.fps;if(options.transition!=null)kindOfTransition=options.transition;if(options.dropIn!=null)direction=-1;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
505 |
var startOffsetPosition=new Spry.Effect.Utils.Position();startOffsetPosition.x=parseInt(Spry.Effect.getStyleProp(element,"left"),10);startOffsetPosition.y=parseInt(Spry.Effect.getStyleProp(element,"top"),10);if(!startOffsetPosition.x)startOffsetPosition.x=0;if(!startOffsetPosition.y)startOffsetPosition.y=0;var fromPos=new Spry.Effect.Utils.Position;fromPos.x=startOffsetPosition.x+0;fromPos.y=startOffsetPosition.y+0;var toPos=new Spry.Effect.Utils.Position;toPos.x=startOffsetPosition.x+0;toPos.y=startOffsetPosition.y+(direction*160);options={from:fromPos,to:toPos,duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var moveEffect=new Spry.Effect.Move(element,options.from,options.to,options);this.addParallelEffect(moveEffect);var fromOpacity=1.0;var toOpacity=0.0;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var opacityEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);this.addParallelEffect(opacityEffect);var self=this;this.addObserver({onPreEffect:function(){self.element.style.display='block';},onPostEffect:function(){if(self.direction==Spry.forwards){self.element.style.display='none';}}});};Spry.Effect.DropOut.prototype=new Spry.Effect.Cluster();Spry.Effect.DropOut.prototype.constructor=Spry.Effect.DropOut;Spry.Effect.Fold=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
506 |
{if(!this.notStaticAnimator) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
507 |
return Spry.Effect.Utils.showInitError('Fold');Spry.Effect.Cluster.call(this,options);var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
508 |
return;this.name='Fold';var durationInMilliseconds=1000;var doToggle=false;var doScaleContent=true;var fullCSSBox=false;var kindOfTransition=Spry.fifthTransition;var fps=fps;Spry.Effect.makeClipping(element);var originalRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var startWidth=originalRect.width;var startHeight=originalRect.height;var stopWidth=startWidth;var stopHeight=startHeight/5;var fromRect=new Spry.Effect.Utils.Rectangle;fromRect.width=startWidth;fromRect.height=startHeight;var toRect=new Spry.Effect.Utils.Rectangle;toRect.width=stopWidth;toRect.height=stopHeight;if(options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
509 |
{if(options.duration!=null)durationInMilliseconds=Math.ceil(options.duration/2);if(options.toggle!=null)doToggle=options.toggle;if(options.useCSSBox!=null)fullCSSBox=options.useCSSBox;if(options.fps!=null)fps=options.fps;if(options.transition!=null)kindOfTransition=options.transition;} |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
510 |
options={duration:durationInMilliseconds,toggle:doToggle,scaleContent:doScaleContent,useCSSBox:fullCSSBox,transition:kindOfTransition,fps:fps};var sizeEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addNextEffect(sizeEffect);fromRect.width=toRect.width;fromRect.height=toRect.height;toRect.width='0%';var sizeEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addNextEffect(sizeEffect);};Spry.Effect.Fold.prototype=new Spry.Effect.Cluster();Spry.Effect.Fold.prototype.constructor=Spry.Effect.Fold;Spry.Effect.DoFade=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
511 |
{return Spry.Effect.Utils.DoEffect('Fade',element,options);};Spry.Effect.DoBlind=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
512 |
{return Spry.Effect.Utils.DoEffect('Blind',element,options);};Spry.Effect.DoHighlight=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
513 |
{return Spry.Effect.Utils.DoEffect('Highlight',element,options);};Spry.Effect.DoSlide=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
514 |
{return Spry.Effect.Utils.DoEffect('Slide',element,options);};Spry.Effect.DoGrow=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
515 |
{return Spry.Effect.Utils.DoEffect('Grow',element,options);};Spry.Effect.DoShake=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
516 |
{return Spry.Effect.Utils.DoEffect('Shake',element,options);};Spry.Effect.DoSquish=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
517 |
{return Spry.Effect.Utils.DoEffect('Squish',element,options);};Spry.Effect.DoPulsate=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
518 |
{return Spry.Effect.Utils.DoEffect('Pulsate',element,options);};Spry.Effect.DoPuff=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
519 |
{return Spry.Effect.Utils.DoEffect('Puff',element,options);};Spry.Effect.DoDropOut=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
520 |
{return Spry.Effect.Utils.DoEffect('DropOut',element,options);};Spry.Effect.DoFold=function(element,options) |
4c16e87cfeae
Optmized a number of Javascript routines for better speed on pathetic Javascript interpreters.
Dan
parents:
174
diff
changeset
|
521 |
{return Spry.Effect.Utils.DoEffect('Fold',element,options);}; |