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(p){return p.effects.define("size",function(i,e){var f,o=p(this),t=["fontSize"],n=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],s=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=i.mode,h="effect"!==r,c=i.scale||"both",a=i.origin||["middle","center"],d=o.css("position"),g=o.position(),m=p.effects.scaledDimensions(o),u=i.from||m,y=i.to||p.effects.scaledDimensions(o,0);p.effects.createPlaceholder(o),"show"===r&&(r=u,u=y,y=r),f={from:{y:u.height/m.height,x:u.width/m.width},to:{y:y.height/m.height,x:y.width/m.width}},"box"!==c&&"both"!==c||(f.from.y!==f.to.y&&(u=p.effects.setTransition(o,n,f.from.y,u),y=p.effects.setTransition(o,n,f.to.y,y)),f.from.x!==f.to.x&&(u=p.effects.setTransition(o,s,f.from.x,u),y=p.effects.setTransition(o,s,f.to.x,y))),"content"!==c&&"both"!==c||f.from.y!==f.to.y&&(u=p.effects.setTransition(o,t,f.from.y,u),y=p.effects.setTransition(o,t,f.to.y,y)),a&&(a=p.effects.getBaseline(a,m),u.top=(m.outerHeight-u.outerHeight)*a.y+g.top,u.left=(m.outerWidth-u.outerWidth)*a.x+g.left,y.top=(m.outerHeight-y.outerHeight)*a.y+g.top,y.left=(m.outerWidth-y.outerWidth)*a.x+g.left),o.css(u),"content"!==c&&"both"!==c||(n=n.concat(["marginTop","marginBottom"]).concat(t),s=s.concat(["marginLeft","marginRight"]),o.find("*[width]").each(function(){var t=p(this),e=p.effects.scaledDimensions(t),o={height:e.height*f.from.y,width:e.width*f.from.x,outerHeight:e.outerHeight*f.from.y,outerWidth:e.outerWidth*f.from.x},e={height:e.height*f.to.y,width:e.width*f.to.x,outerHeight:e.height*f.to.y,outerWidth:e.width*f.to.x};f.from.y!==f.to.y&&(o=p.effects.setTransition(t,n,f.from.y,o),e=p.effects.setTransition(t,n,f.to.y,e)),f.from.x!==f.to.x&&(o=p.effects.setTransition(t,s,f.from.x,o),e=p.effects.setTransition(t,s,f.to.x,e)),h&&p.effects.saveStyle(t),t.css(o),t.animate(e,i.duration,i.easing,function(){h&&p.effects.restoreStyle(t)})})),o.animate(y,{queue:!1,duration:i.duration,easing:i.easing,complete:function(){var t=o.offset();0===y.opacity&&o.css("opacity",u.opacity),h||(o.css("position","static"===d?"relative":d).offset(t),p.effects.saveStyle(o)),e()}})})});