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

9 lines
2.4 KiB
JavaScript

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