Add jquery.masonry.min.js. fixes #25351.

Built from https://develop.svn.wordpress.org/trunk@27389


git-svn-id: http://core.svn.wordpress.org/trunk@27237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-04 02:20:14 +00:00
parent 5fd175300c
commit 3028e6e7fb
3 changed files with 12 additions and 80 deletions

View File

@ -1,79 +0,0 @@
/*!
* Masonry v2 shim
* to maintain backwards compatibility
* as of Masonry v3.1.2
*
* Cascading grid layout library
* http://masonry.desandro.com
* MIT License
* by David DeSandro
*/
( function( window ) {
var Masonry = window.Masonry;
Masonry.prototype._remapV2Options = function() {
// map v2 options to v3 equivalents
this._remapOption( 'gutterWidth', 'gutter' );
this._remapOption( 'isResizable', 'isResizeBound' );
this._remapOption( 'isRTL', 'isOriginLeft', function( opt ) {
return !opt;
});
// override transitionDuration with isAnimated
var isAniOption = this.options.isAnimated;
if ( isAniOption !== undefined ) {
this.options.transitionDuration = isAniOption ?
Masonry.prototype.options.transitionDuration : 0;
}
if ( isAniOption === undefined || isAniOption ) {
// use animation Duration option in place of transitionDuration
var aniOptions = this.options.animationOptions;
var aniDuration = aniOptions && aniOptions.duration;
if ( aniDuration ) {
this.options.transitionDuration = typeof aniDuration === 'string' ?
aniDuration : aniDuration + 'ms';
}
}
};
Masonry.prototype._remapOption = function( from, to, munge ) {
var fromOption = this.options[ from ];
if ( fromOption !== undefined ) {
this.options[ to ] = munge ? munge( fromOption ) : fromOption;
}
};
// remap v2 options for necessary methods
var __create = Masonry.prototype._create;
Masonry.prototype._create = function() {
this._remapV2Options();
__create.apply( this, arguments );
};
var _layout = Masonry.prototype.layout;
Masonry.prototype.layout = function() {
this._remapV2Options();
_layout.apply( this, arguments );
};
var _option = Masonry.prototype.option;
Masonry.prototype.option = function() {
_option.apply( this, arguments );
this._remapV2Options();
};
// re-enable using function for columnWidth
var _measureColumns = Masonry.prototype.measureColumns;
Masonry.prototype.measureColumns = function() {
var colWOpt = this.options.columnWidth;
if ( colWOpt && typeof colWOpt === 'function' ) {
this.getContainerWidth();
this.columnWidth = colWOpt( this.containerWidth );
}
_measureColumns.apply( this, arguments );
};
})( window );

View File

@ -0,0 +1,11 @@
/*!
* Masonry v2 shim
* to maintain backwards compatibility
* as of Masonry v3.1.2
*
* Cascading grid layout library
* http://masonry.desandro.com
* MIT License
* by David DeSandro
*/
!function(a){var b=a.Masonry;b.prototype._remapV2Options=function(){this._remapOption("gutterWidth","gutter"),this._remapOption("isResizable","isResizeBound"),this._remapOption("isRTL","isOriginLeft",function(a){return!a});var a=this.options.isAnimated;if(void 0!==a&&(this.options.transitionDuration=a?b.prototype.options.transitionDuration:0),void 0===a||a){var c=this.options.animationOptions,d=c&&c.duration;d&&(this.options.transitionDuration="string"==typeof d?d:d+"ms")}},b.prototype._remapOption=function(a,b,c){var d=this.options[a];void 0!==d&&(this.options[b]=c?c(d):d)};var c=b.prototype._create;b.prototype._create=function(){this._remapV2Options(),c.apply(this,arguments)};var d=b.prototype.layout;b.prototype.layout=function(){this._remapV2Options(),d.apply(this,arguments)};var e=b.prototype.option;b.prototype.option=function(){e.apply(this,arguments),this._remapV2Options()};var f=b.prototype.measureColumns;b.prototype.measureColumns=function(){var a=this.options.columnWidth;a&&"function"==typeof a&&(this.getContainerWidth(),this.columnWidth=a(this.containerWidth)),f.apply(this,arguments)}}(window);

View File

@ -201,7 +201,7 @@ function wp_default_scripts( &$scripts ) {
// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
$scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array(), '3.1.2', 1 );
$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$suffix.js", array( 'jquery', 'masonry' ), '3.1.2', 1 );
$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2', 1 );
$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(