WordPress.org

Make WordPress Core

Changeset 27779


Ignore:
Timestamp:
03/27/2014 07:24:04 AM (7 years ago)
Author:
nacin
Message:

Update Masonry v2/v3 shim from upstream.

props kovshenin.
see #27510.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/jquery/jquery.masonry.js

    r27271 r27779  
    1010 */
    1111( function( window ) {
     12
     13  'use strict';
    1214
    1315  var Masonry = window.Masonry;
     
    5052  var __create = Masonry.prototype._create;
    5153  Masonry.prototype._create = function() {
     54    var that = this;
    5255    this._remapV2Options();
    5356    __create.apply( this, arguments );
     57    setTimeout( function() {
     58      jQuery( that.element ).addClass( 'masonry' );
     59    }, 0 );
    5460  };
    5561
     
    6672  };
    6773
     74  var __itemize = Masonry.prototype._itemize;
     75  Masonry.prototype._itemize = function( elements ) {
     76    var items = __itemize.apply( this, arguments );
     77    jQuery( elements ).addClass( 'masonry-brick' );
     78    return items;
     79  };
     80
    6881  // re-enable using function for columnWidth
    6982  var _measureColumns = Masonry.prototype.measureColumns;
     
    7790  };
    7891
     92  Masonry.prototype.reload = function() {
     93    this.reloadItems.apply( this, arguments );
     94    this.layout.apply( this );
     95  };
     96
     97  var _destroy = Masonry.prototype.destroy;
     98  Masonry.prototype.destroy = function() {
     99    var items = this.getItemElements();
     100    jQuery( this.element ).removeClass( 'masonry' );
     101    jQuery( items ).removeClass( 'masonry-brick' );
     102    _destroy.apply( this, arguments );
     103  };
     104
    79105})( window );
Note: See TracChangeset for help on using the changeset viewer.