wp/wp-includes/js/jquery/ui/effect-explode.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 /*!
     1 /*!
     2  * jQuery UI Effects Explode 1.12.1
     2  * jQuery UI Effects Explode 1.13.1
     3  * http://jqueryui.com
     3  * http://jqueryui.com
     4  *
     4  *
     5  * Copyright jQuery Foundation and other contributors
     5  * Copyright jQuery Foundation and other contributors
     6  * Released under the MIT license.
     6  * Released under the MIT license.
     7  * http://jquery.org/license
     7  * http://jquery.org/license
     8  */
     8  */
     9 
     9 
    10 //>>label: Explode Effect
    10 //>>label: Explode Effect
    11 //>>group: Effects
    11 //>>group: Effects
    12 // jscs:disable maximumLineLength
    12 /* eslint-disable max-len */
    13 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
    13 //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
    14 // jscs:enable maximumLineLength
    14 /* eslint-enable max-len */
    15 //>>docs: http://api.jqueryui.com/explode-effect/
    15 //>>docs: http://api.jqueryui.com/explode-effect/
    16 //>>demos: http://jqueryui.com/effect/
    16 //>>demos: http://jqueryui.com/effect/
    17 
    17 
    18 ( function( factory ) {
    18 ( function( factory ) {
       
    19 	"use strict";
       
    20 
    19 	if ( typeof define === "function" && define.amd ) {
    21 	if ( typeof define === "function" && define.amd ) {
    20 
    22 
    21 		// AMD. Register as an anonymous module.
    23 		// AMD. Register as an anonymous module.
    22 		define( [
    24 		define( [
    23 			"jquery",
    25 			"jquery",
    26 	} else {
    28 	} else {
    27 
    29 
    28 		// Browser globals
    30 		// Browser globals
    29 		factory( jQuery );
    31 		factory( jQuery );
    30 	}
    32 	}
    31 }( function( $ ) {
    33 } )( function( $ ) {
       
    34 "use strict";
    32 
    35 
    33 return $.effects.define( "explode", "hide", function( options, done ) {
    36 return $.effects.define( "explode", "hide", function( options, done ) {
    34 
    37 
    35 	var i, j, left, top, mx, my,
    38 	var i, j, left, top, mx, my,
    36 		rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
    39 		rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
    78 				} )
    81 				} )
    79 
    82 
    80 				// Select the wrapper - make it overflow: hidden and absolute positioned based on
    83 				// Select the wrapper - make it overflow: hidden and absolute positioned based on
    81 				// where the original was located +left and +top equal to the size of pieces
    84 				// where the original was located +left and +top equal to the size of pieces
    82 				.parent()
    85 				.parent()
    83 					.addClass( "ui-effects-explode" )
    86 				.addClass( "ui-effects-explode" )
    84 					.css( {
    87 				.css( {
    85 						position: "absolute",
    88 					position: "absolute",
    86 						overflow: "hidden",
    89 					overflow: "hidden",
    87 						width: width,
    90 					width: width,
    88 						height: height,
    91 					height: height,
    89 						left: left + ( show ? mx * width : 0 ),
    92 					left: left + ( show ? mx * width : 0 ),
    90 						top: top + ( show ? my * height : 0 ),
    93 					top: top + ( show ? my * height : 0 ),
    91 						opacity: show ? 0 : 1
    94 					opacity: show ? 0 : 1
    92 					} )
    95 				} )
    93 					.animate( {
    96 				.animate( {
    94 						left: left + ( show ? 0 : mx * width ),
    97 					left: left + ( show ? 0 : mx * width ),
    95 						top: top + ( show ? 0 : my * height ),
    98 					top: top + ( show ? 0 : my * height ),
    96 						opacity: show ? 1 : 0
    99 					opacity: show ? 1 : 0
    97 					}, options.duration || 500, options.easing, childComplete );
   100 				}, options.duration || 500, options.easing, childComplete );
    98 		}
   101 		}
    99 	}
   102 	}
   100 
   103 
   101 	function animComplete() {
   104 	function animComplete() {
   102 		element.css( {
   105 		element.css( {
   105 		$( pieces ).remove();
   108 		$( pieces ).remove();
   106 		done();
   109 		done();
   107 	}
   110 	}
   108 } );
   111 } );
   109 
   112 
   110 } ) );
   113 } );