11<?php
22namespace Ajax \service ;
3+ use Ajax \semantic \html \base \constants \Transition ;
4+
35class AjaxTransition {
46 public static function none ($ responseElement ,$ jqueryDone ="html " ){
57 return "$( {$ responseElement }). {$ jqueryDone }( data ) " ;
68 }
79
8- public static function fade ($ responseElement ,$ jqueryDone ="html " ){
10+ public static function jqFade ($ responseElement ,$ jqueryDone ="html " ){
911 return "$( {$ responseElement }).hide(). {$ jqueryDone }( data ).fadeIn() " ;
1012 }
1113
12- public static function slide ($ responseElement ,$ jqueryDone ="html " ){
14+ public static function jqSlide ($ responseElement ,$ jqueryDone ="html " ){
1315 return "$( {$ responseElement }).hide(). {$ jqueryDone }( data ).slideDown() " ;
1416 }
1517
16- public static function bSlidedown ($ responseElement ,$ jqueryDone ="html " ){
17- return "$( {$ responseElement }). {$ jqueryDone }( data ).transition('slide down in') " ;
18+ public static function random ($ responseElement ,$ jqueryDone ="html " ){
19+ $ transitions =Transition::getConstantValues ();
20+ $ transition =$ transitions [\rand (0 ,\sizeof ($ transitions )-1 )];
21+ return self ::__callStatic ($ transition , [$ responseElement ,$ jqueryDone ]);
1822 }
1923
20- public static function bScale ($ responseElement ,$ jqueryDone ="html " ){
21- return "$( {$ responseElement }). {$ jqueryDone }( data ).transition('scale in') " ;
24+ public static function __callStatic ($ name , $ arguments ){
25+ if (\sizeof ($ arguments )==2 ){
26+ $ responseElement =$ arguments [0 ];
27+ $ jqueryDone =$ arguments [1 ];
28+ $ name =JString::camelCaseToSeparated ($ name );
29+ return "$( {$ responseElement }). {$ jqueryDone }( data ).transition(' {$ name } in') " ;
30+ }
2231 }
2332}
0 commit comments