1/*! 2 * Masonry layout mode 3 * sub-classes Masonry 4 * http://masonry.desandro.com 5 */ 6 7( function( window ) { 8 9'use strict'; 10 11// -------------------------- helpers -------------------------- // 12 13// extend objects 14function extend( a, b ) { 15 for ( var prop in b ) { 16 a[ prop ] = b[ prop ]; 17 } 18 return a; 19} 20 21// -------------------------- masonryDefinition -------------------------- // 22 23// used for AMD definition and requires 24function masonryDefinition( LayoutMode, Masonry ) { 25 // create an Outlayer layout class 26 var MasonryMode = LayoutMode.create('masonry'); 27 28 // save on to these methods 29 var _getElementOffset = MasonryMode.prototype._getElementOffset; 30 var layout = MasonryMode.prototype.layout; 31 var _getMeasurement = MasonryMode.prototype._getMeasurement; 32 33 // sub-class Masonry 34 extend( MasonryMode.prototype, Masonry.prototype ); 35 36 // set back, as it was overwritten by Masonry 37 MasonryMode.prototype._getElementOffset = _getElementOffset; 38 MasonryMode.prototype.layout = layout; 39 MasonryMode.prototype._getMeasurement = _getMeasurement; 40 41 var measureColumns = MasonryMode.prototype.measureColumns; 42 MasonryMode.prototype.measureColumns = function() { 43 // set items, used if measuring first item 44 this.items = this.isotope.filteredItems; 45 measureColumns.call( this ); 46 }; 47 48 // HACK copy over isOriginLeft/Top options 49 var _manageStamp = MasonryMode.prototype._manageStamp; 50 MasonryMode.prototype._manageStamp = function() { 51 this.options.isOriginLeft = this.isotope.options.isOriginLeft; 52 this.options.isOriginTop = this.isotope.options.isOriginTop; 53 _manageStamp.apply( this, arguments ); 54 }; 55 56 return MasonryMode; 57} 58 59// -------------------------- transport -------------------------- // 60 61if ( typeof define === 'function' && define.amd ) { 62 // AMD 63 define( [ 64 '../layout-mode', 65 'masonry/masonry' 66 ], 67 masonryDefinition ); 68} else if ( typeof exports === 'object' ) { 69 // CommonJS 70 module.exports = masonryDefinition( 71 require('../layout-mode'), 72 require('masonry-layout') 73 ); 74} else { 75 // browser global 76 masonryDefinition( 77 window.Isotope.LayoutMode, 78 window.Masonry 79 ); 80} 81 82})( window );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.