From 203b10531a65a4d59bdce74bc6644d8621cd6a1a Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 16 Sep 2006 01:27:27 +0000 Subject: Fixed #363 --- framework/Web/Javascripts/extended/effects.js | 7 +++++++ framework/Web/Javascripts/js/compressed/effects.js | 3 ++- framework/Web/Javascripts/js/debug/effects.js | 8 ++++++++ framework/Web/UI/ActiveControls/TCallbackClientScript.php | 4 ++-- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 framework/Web/Javascripts/extended/effects.js (limited to 'framework/Web') diff --git a/framework/Web/Javascripts/extended/effects.js b/framework/Web/Javascripts/extended/effects.js new file mode 100644 index 00000000..236686df --- /dev/null +++ b/framework/Web/Javascripts/extended/effects.js @@ -0,0 +1,7 @@ +Prado.Effect = +{ + Highlight : function(element, options) + { + new Effect.Highlight(element,options||{}); + } +} \ No newline at end of file diff --git a/framework/Web/Javascripts/js/compressed/effects.js b/framework/Web/Javascripts/js/compressed/effects.js index 8870d77f..1a2915e6 100644 --- a/framework/Web/Javascripts/js/compressed/effects.js +++ b/framework/Web/Javascripts/js/compressed/effects.js @@ -63,4 +63,5 @@ return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,befo Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;} return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned();effect.effects[0].element.makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide();effect.effects[0].element.undoClipping();effect.effects[0].element.undoPositioned();effect.effects[0].element.setStyle(oldStyle);}},options));} Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=element.getInlineOpacity();var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:3.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));} -Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};Element.makeClipping(element);return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.setStyle(oldStyle);}});}},arguments[1]||{}));};['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom','collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each(function(f){Element.Methods[f]=Element[f];});Element.Methods.visualEffect=function(element,effect,options){s=effect.gsub(/_/,'-').camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](element,options);return $(element);};Element.addMethods(); \ No newline at end of file +Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};Element.makeClipping(element);return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide();effect.element.undoClipping();effect.element.setStyle(oldStyle);}});}},arguments[1]||{}));};['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom','collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each(function(f){Element.Methods[f]=Element[f];});Element.Methods.visualEffect=function(element,effect,options){s=effect.gsub(/_/,'-').camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](element,options);return $(element);};Element.addMethods();Prado.Effect={Highlight:function(element,options) +{new Effect.Highlight(element,options||{});}} \ No newline at end of file diff --git a/framework/Web/Javascripts/js/debug/effects.js b/framework/Web/Javascripts/js/debug/effects.js index 7e8ba2ed..c0f3c4af 100644 --- a/framework/Web/Javascripts/js/debug/effects.js +++ b/framework/Web/Javascripts/js/debug/effects.js @@ -958,3 +958,11 @@ Element.Methods.visualEffect = function(element, effect, options) { Element.addMethods(); +Prado.Effect = +{ + Highlight : function(element, options) + { + new Effect.Highlight(element,options||{}); + } +} + diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php index ebc5942f..4b568987 100644 --- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php +++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php @@ -417,7 +417,7 @@ class TCallbackClientScript extends TApplicationComponent */ public function visualEffect($type, $element, $options=null) { - $this->callClientFunction($type, is_array($options) ? array($element, $options) : $element); + $this->callClientFunction($type, array($element, $options)); } /** @@ -578,7 +578,7 @@ class TCallbackClientScript extends TApplicationComponent */ public function highlight($element, $options=null) { - $this->visualEffect('Effect.Highlight', $element, $options); + $this->visualEffect('Prado.Effect.Highlight', $element, $options); } } -- cgit v1.2.3