UPDATE 4.4.0.0
[phpmyadmin.git] / js / jquery / src / jquery-ui / effect-clip.js
blob9fcfc67a6b2261cca3831069efddabee2dae8041
1 /*!
2  * jQuery UI Effects Clip 1.11.2
3  * http://jqueryui.com
4  *
5  * Copyright 2014 jQuery Foundation and other contributors
6  * Released under the MIT license.
7  * http://jquery.org/license
8  *
9  * http://api.jqueryui.com/clip-effect/
10  */
11 (function( factory ) {
12         if ( typeof define === "function" && define.amd ) {
14                 // AMD. Register as an anonymous module.
15                 define([
16                         "jquery",
17                         "./effect"
18                 ], factory );
19         } else {
21                 // Browser globals
22                 factory( jQuery );
23         }
24 }(function( $ ) {
26 return $.effects.effect.clip = function( o, done ) {
27         // Create element
28         var el = $( this ),
29                 props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
30                 mode = $.effects.setMode( el, o.mode || "hide" ),
31                 show = mode === "show",
32                 direction = o.direction || "vertical",
33                 vert = direction === "vertical",
34                 size = vert ? "height" : "width",
35                 position = vert ? "top" : "left",
36                 animation = {},
37                 wrapper, animate, distance;
39         // Save & Show
40         $.effects.save( el, props );
41         el.show();
43         // Create Wrapper
44         wrapper = $.effects.createWrapper( el ).css({
45                 overflow: "hidden"
46         });
47         animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
48         distance = animate[ size ]();
50         // Shift
51         if ( show ) {
52                 animate.css( size, 0 );
53                 animate.css( position, distance / 2 );
54         }
56         // Create Animation Object:
57         animation[ size ] = show ? distance : 0;
58         animation[ position ] = show ? 0 : distance / 2;
60         // Animate
61         animate.animate( animation, {
62                 queue: false,
63                 duration: o.duration,
64                 easing: o.easing,
65                 complete: function() {
66                         if ( !show ) {
67                                 el.hide();
68                         }
69                         $.effects.restore( el, props );
70                         $.effects.removeWrapper( el );
71                         done();
72                 }
73         });
77 }));