WordPress/wp-includes/js/jquery/ui/effect-size.min.js

11 lines
3.2 KiB
JavaScript

/*!
* jQuery UI Effects Size 1.11.4
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/size-effect/
*/
!function(t){"function"==typeof define&&define.amd?define(["jquery","./effect"],t):t(jQuery)}(function(x){return x.effects.effect.size=function(r,t){var o,e,h,n=x(this),i=["position","top","bottom","left","right","width","height","overflow","opacity"],s=["width","height","overflow"],f=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],d=x.effects.setMode(n,r.mode||"effect"),m=r.restore||"effect"!==d,g=r.scale||"both",u=r.origin||["middle","center"],p=n.css("position"),y=m?i:["position","top","bottom","left","right","overflow","opacity"],w={height:0,width:0,outerHeight:0,outerWidth:0};"show"===d&&n.show(),o={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()},"toggle"===r.mode&&"show"===d?(n.from=r.to||w,n.to=r.from||o):(n.from=r.from||("show"===d?w:o),n.to=r.to||("hide"===d?w:o)),h={from:{y:n.from.height/o.height,x:n.from.width/o.width},to:{y:n.to.height/o.height,x:n.to.width/o.width}},"box"!==g&&"both"!==g||(h.from.y!==h.to.y&&(y=y.concat(c),n.from=x.effects.setTransition(n,c,h.from.y,n.from),n.to=x.effects.setTransition(n,c,h.to.y,n.to)),h.from.x!==h.to.x&&(y=y.concat(a),n.from=x.effects.setTransition(n,a,h.from.x,n.from),n.to=x.effects.setTransition(n,a,h.to.x,n.to))),"content"!==g&&"both"!==g||h.from.y!==h.to.y&&(y=y.concat(f).concat(s),n.from=x.effects.setTransition(n,f,h.from.y,n.from),n.to=x.effects.setTransition(n,f,h.to.y,n.to)),x.effects.save(n,y),n.show(),x.effects.createWrapper(n),n.css("overflow","hidden").css(n.from),u&&(e=x.effects.getBaseline(u,o),n.from.top=(o.outerHeight-n.outerHeight())*e.y,n.from.left=(o.outerWidth-n.outerWidth())*e.x,n.to.top=(o.outerHeight-n.to.outerHeight)*e.y,n.to.left=(o.outerWidth-n.to.outerWidth)*e.x),n.css(n.from),"content"!==g&&"both"!==g||(c=c.concat(["marginTop","marginBottom"]).concat(f),a=a.concat(["marginLeft","marginRight"]),s=i.concat(c).concat(a),n.find("*[width]").each(function(){var t=x(this),o=t.height(),e=t.width(),i=t.outerHeight(),f=t.outerWidth();m&&x.effects.save(t,s),t.from={height:o*h.from.y,width:e*h.from.x,outerHeight:i*h.from.y,outerWidth:f*h.from.x},t.to={height:o*h.to.y,width:e*h.to.x,outerHeight:o*h.to.y,outerWidth:e*h.to.x},h.from.y!==h.to.y&&(t.from=x.effects.setTransition(t,c,h.from.y,t.from),t.to=x.effects.setTransition(t,c,h.to.y,t.to)),h.from.x!==h.to.x&&(t.from=x.effects.setTransition(t,a,h.from.x,t.from),t.to=x.effects.setTransition(t,a,h.to.x,t.to)),t.css(t.from),t.animate(t.to,r.duration,r.easing,function(){m&&x.effects.restore(t,s)})})),n.animate(n.to,{queue:!1,duration:r.duration,easing:r.easing,complete:function(){0===n.to.opacity&&n.css("opacity",n.from.opacity),"hide"===d&&n.hide(),x.effects.restore(n,y),m||("static"===p?n.css({position:"relative",top:n.to.top,left:n.to.left}):x.each(["top","left"],function(f,t){n.css(t,function(t,o){var e=parseInt(o,10),i=f?n.to.left:n.to.top;return"auto"===o?i+"px":e+i+"px"})})),x.effects.removeWrapper(n),t()}})}});