jQuery UI 1.10 has already been released, and 1.11 is on the horizon (1.9 is marked "legacy" as of writing). 1.10 drops the compatibility layer for 1.8 API. So, users should definitely be encouraged to upgrade their code to move away from the deprecated 1.8 APIs. However, to take it one step at a time, this commit upgrades us to 1.9 first. That way we're at least not using an unsupported code base anymore, while at the same time not rolling out breaking changes. jQuery UI has redesigned many of its APIs[1], but compatibility with the jQuery UI 1.8 API is maintained throughout 1.9.x. * Base theme is now called "Smoothness". * Sorting the entries in Resources.php alphabetically to make it easier to ensure all files are listed when comparing them side-by-side. * Update dependencies to match the "Depends:" header inside the javascript files. * In jQuery UI 1.9, effect files were renamed to match the jquery.ui.*.js naming pattern. * New modules: - jquery.ui.menu - jquery.ui.spinner - jquery.ui.tooltip * Release notes: - http://blog.jqueryui.com/2012/10/jquery-ui-1-9-0/ - http://jqueryui.com/upgrade-guide/1.9/ - http://jqueryui.com/changelog/1.9.0/ - http://blog.jqueryui.com/2012/10/jquery-ui-1-9-1/ - http://jqueryui.com/changelog/1.9.1/ - http://blog.jqueryui.com/2012/11/jquery-ui-1-9-2/ [1] http://blog.jqueryui.com/2011/03/api-redesigns-the-past-present-and-future/ Bug: 47076 Change-Id: I0e10b42fb7c25b9d4704719f21c44c08f36ddfa7
97 lines
2.3 KiB
JavaScript
97 lines
2.3 KiB
JavaScript
/*!
|
|
* jQuery UI Effects Explode 1.9.2
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright 2012 jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*
|
|
* http://api.jqueryui.com/explode-effect/
|
|
*
|
|
* Depends:
|
|
* jquery.ui.effect.js
|
|
*/
|
|
(function( $, undefined ) {
|
|
|
|
$.effects.effect.explode = function( o, done ) {
|
|
|
|
var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
|
|
cells = rows,
|
|
el = $( this ),
|
|
mode = $.effects.setMode( el, o.mode || "hide" ),
|
|
show = mode === "show",
|
|
|
|
// show and then visibility:hidden the element before calculating offset
|
|
offset = el.show().css( "visibility", "hidden" ).offset(),
|
|
|
|
// width and height of a piece
|
|
width = Math.ceil( el.outerWidth() / cells ),
|
|
height = Math.ceil( el.outerHeight() / rows ),
|
|
pieces = [],
|
|
|
|
// loop
|
|
i, j, left, top, mx, my;
|
|
|
|
// children animate complete:
|
|
function childComplete() {
|
|
pieces.push( this );
|
|
if ( pieces.length === rows * cells ) {
|
|
animComplete();
|
|
}
|
|
}
|
|
|
|
// clone the element for each row and cell.
|
|
for( i = 0; i < rows ; i++ ) { // ===>
|
|
top = offset.top + i * height;
|
|
my = i - ( rows - 1 ) / 2 ;
|
|
|
|
for( j = 0; j < cells ; j++ ) { // |||
|
|
left = offset.left + j * width;
|
|
mx = j - ( cells - 1 ) / 2 ;
|
|
|
|
// Create a clone of the now hidden main element that will be absolute positioned
|
|
// within a wrapper div off the -left and -top equal to size of our pieces
|
|
el
|
|
.clone()
|
|
.appendTo( "body" )
|
|
.wrap( "<div></div>" )
|
|
.css({
|
|
position: "absolute",
|
|
visibility: "visible",
|
|
left: -j * width,
|
|
top: -i * height
|
|
})
|
|
|
|
// select the wrapper - make it overflow: hidden and absolute positioned based on
|
|
// where the original was located +left and +top equal to the size of pieces
|
|
.parent()
|
|
.addClass( "ui-effects-explode" )
|
|
.css({
|
|
position: "absolute",
|
|
overflow: "hidden",
|
|
width: width,
|
|
height: height,
|
|
left: left + ( show ? mx * width : 0 ),
|
|
top: top + ( show ? my * height : 0 ),
|
|
opacity: show ? 0 : 1
|
|
}).animate({
|
|
left: left + ( show ? 0 : mx * width ),
|
|
top: top + ( show ? 0 : my * height ),
|
|
opacity: show ? 1 : 0
|
|
}, o.duration || 500, o.easing, childComplete );
|
|
}
|
|
}
|
|
|
|
function animComplete() {
|
|
el.css({
|
|
visibility: "visible"
|
|
});
|
|
$( pieces ).remove();
|
|
if ( !show ) {
|
|
el.hide();
|
|
}
|
|
done();
|
|
}
|
|
};
|
|
|
|
})(jQuery);
|