13 <div class=item
>Lorem ipsum dolor sit amet, consectetur adipiscing elit, seddo eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim adminim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip exea commodo consequat. Duis aute irure dolor in reprehenderit in voluptatevelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecatcupidatat non proident, sunt in culpa qui officia deserunt mollit anim id estlaborum.
</div>
17 * Masonry PACKAGED v3.2.2
18 * Cascading grid layout library
19 * http://masonry.desandro.com
28 b
.prototype.option
|| (b
.prototype.option = function(b
) {
29 a
.isPlainObject(b
) && (this.options
= a
.extend(!0, this.options
,
35 a
.fn
[b
] = function(e
) {
36 if ("string" == typeof e
) {
37 for (var g
= d
.call(arguments
, 1), h
= 0, i
= this.length
; i
42 if (a
.isFunction(k
[e
]) && "_" !== e
.charAt(0)) {
43 var l
= k
[e
].apply(k
, g
);
44 if (void 0 !== l
) return l
45 } else f("no such method '" + e
+ "' for " + b
+
47 else f("cannot call methods on " + b
+
48 " prior to initialization; attempted to call '" +
53 return this.each(function() {
54 var d
= a
.data(this, b
);
55 d
? (d
.option(e
), d
._init()) : (d
= new c(this, e
),
61 var f
= "undefined" == typeof console
? b : function(a
) {
64 return a
.bridget = function(a
, b
) {
69 var d
= Array
.prototype.slice
;
70 "function" == typeof define
&& define
.amd
?
71 define("jquery-bridget/jquery.bridget", ["jquery"], c
) : c("object" ==
72 typeof exports
? require("jquery") : a
.jQuery
)
77 return c
.target
= c
.target
|| c
.srcElement
|| b
, c
79 var c
= document
.documentElement
,
81 c
.addEventListener
? d = function(a
, b
, c
) {
82 a
.addEventListener(b
, c
, !1)
83 } : c
.attachEvent
&& (d = function(a
, c
, d
) {
84 a
[c
+ d
] = d
.handleEvent
? function() {
86 d
.handleEvent
.call(d
, c
)
90 }, a
.attachEvent("on" + c
, a
[c
+ d
])
92 var e = function() {};
93 c
.removeEventListener
? e = function(a
, b
, c
) {
94 a
.removeEventListener(b
, c
, !1)
95 } : c
.detachEvent
&& (e = function(a
, b
, c
) {
96 a
.detachEvent("on" + b
, a
[b
+ c
]);
107 "function" == typeof define
&& define
.amd
? define("eventie/eventie", f
) :
108 "object" == typeof exports
? module
.exports
= f
: a
.eventie
= f
112 "function" == typeof a
&& (b
.isReady
? a() : g
.push(a
))
116 var c
= "readystatechange" === a
.type
&& "complete" !== f
.readyState
;
117 b
.isReady
|| c
|| d()
122 for (var a
= 0, c
= g
.length
; c
> a
; a
++) {
129 return "complete" === f
.readyState
? d() : (e
.bind(f
,
130 "DOMContentLoaded", c
), e
.bind(f
, "readystatechange", c
),
131 e
.bind(a
, "load", c
)), b
135 b
.isReady
= !1, "function" == typeof define
&& define
.amd
?
136 define("doc-ready/doc-ready", ["eventie/eventie"], e
) : "object" == typeof
137 exports
? module
.exports
= e(require("eventie")) : a
.docReady
=
144 for (var c
= a
.length
; c
--;)
145 if (a
[c
].listener
=== b
) return c
;
151 return this[a
].apply(this, arguments
)
157 d
.getListeners = function(a
) {
158 var b
, c
, d
= this._getEvents();
159 if (a
instanceof RegExp
) {
161 for (c
in d
) d
.hasOwnProperty(c
) && a
.test(c
) && (b
[c
] = d
[c
])
162 } else b
= d
[a
] || (d
[a
] = []);
164 }, d
.flattenListeners = function(a
) {
166 for (b
= 0; b
< a
.length
; b
+= 1) c
.push(a
[b
].listener
);
168 }, d
.getListenersAsObject = function(a
) {
169 var b
, c
= this.getListeners(a
);
170 return c
instanceof Array
&& (b
= {}, b
[a
] = c
), b
|| c
171 }, d
.addListener = function(a
, c
) {
172 var d
, e
= this.getListenersAsObject(a
),
173 f
= "object" == typeof c
;
174 for (d
in e
) e
.hasOwnProperty(d
) && -1 === b(e
[d
], c
) && e
[d
].push(f
? c
180 }, d
.on
= c("addListener"), d
.addOnceListener = function(a
, b
) {
181 return this.addListener(a
, {
185 }, d
.once
= c("addOnceListener"), d
.defineEvent = function(a
) {
186 return this.getListeners(a
), this
187 }, d
.defineEvents = function(a
) {
188 for (var b
= 0; b
< a
.length
; b
+= 1) this.defineEvent(a
[b
]);
190 }, d
.removeListener = function(a
, c
) {
191 var d
, e
, f
= this.getListenersAsObject(a
);
192 for (e
in f
) f
.hasOwnProperty(e
) && (d
= b(f
[e
], c
), -1 !== d
&&
195 }, d
.off
= c("removeListener"), d
.addListeners = function(a
, b
) {
196 return this.manipulateListeners(!1, a
, b
)
197 }, d
.removeListeners = function(a
, b
) {
198 return this.manipulateListeners(!0, a
, b
)
199 }, d
.manipulateListeners = function(a
, b
, c
) {
200 var d
, e
, f
= a
? this.removeListener
: this.addListener
,
201 g
= a
? this.removeListeners
: this.addListeners
;
202 if ("object" != typeof b
|| b
instanceof RegExp
)
203 for (d
= c
.length
; d
--;) f
.call(this, b
, c
[d
]);
205 for (d
in b
) b
.hasOwnProperty(d
) && (e
= b
[d
]) && ("function" ==
206 typeof e
? f
.call(this, d
, e
) : g
.call(this, d
, e
));
208 }, d
.removeEvent = function(a
) {
210 d
= this._getEvents();
211 if ("string" === c
) delete d
[a
];
212 else if (a
instanceof RegExp
)
213 for (b
in d
) d
.hasOwnProperty(b
) && a
.test(b
) && delete d
[b
];
214 else delete this._events
;
216 }, d
.removeAllListeners
= c("removeEvent"), d
.emitEvent = function(a
, b
) {
217 var c
, d
, e
, f
, g
= this.getListenersAsObject(a
);
219 if (g
.hasOwnProperty(e
))
220 for (d
= g
[e
].length
; d
--;) c
= g
[e
][d
], c
.once
=== !0 &&
221 this.removeListener(a
, c
.listener
), f
= c
.listener
.apply(this,
222 b
|| []), f
=== this._getOnceReturnValue() &&
223 this.removeListener(a
, c
.listener
);
225 }, d
.trigger
= c("emitEvent"), d
.emit = function(a
) {
226 var b
= Array
.prototype.slice
.call(arguments
, 1);
227 return this.emitEvent(a
, b
)
228 }, d
.setOnceReturnValue = function(a
) {
229 return this._onceReturnValue
= a
, this
230 }, d
._getOnceReturnValue = function() {
231 return this.hasOwnProperty("_onceReturnValue") ? this._onceReturnValue
:
233 }, d
._getEvents = function() {
234 return this._events
|| (this._events
= {})
235 }, a
.noConflict = function() {
236 return e
.EventEmitter
= f
, a
237 }, "function" == typeof define
&& define
.amd
?
238 define("eventEmitter/EventEmitter", [], function() {
240 }) : "object" == typeof module
&& module
.exports
? module
.exports
= a
:
246 if ("string" == typeof d
[a
]) return a
;
247 a
= a
.charAt(0).toUpperCase() + a
.slice(1);
248 for (var b
, e
= 0, f
= c
.length
; f
> e
; e
++)
249 if (b
= c
[e
] + a
, "string" == typeof d
[b
]) return b
252 var c
= "Webkit Moz ms Ms O".split(" "),
253 d
= document
.documentElement
.style
;
254 "function" == typeof define
&& define
.amd
?
255 define("get-style-property/get-style-property", [], function() {
257 }) : "object" == typeof exports
? module
.exports
= b
:
258 a
.getStyleProperty
= b
262 var b
= parseFloat(a
),
263 c
= -1 === a
.indexOf("%") && !isNaN(b
);
277 }, b
= 0, c
= g
.length
; c
> b
; b
++) {
288 var d
= a
.getComputedStyle
;
290 var a
= d
? function(a
) {
293 return a
.currentStyle
297 return c
|| f("Style returned " + c
), c
299 }(), k
= c("boxSizing")) {
300 var e
= document
.createElement("div");
301 e
.style
.width
= "200px",
302 e
.style
.padding
= "1px 2px 3px 4px",
303 e
.style
.borderStyle
= "solid",
304 e
.style
.borderWidth
= "1px 2px 3px 4px", e
.style
[k
] =
306 var g
= document
.body
|| document
.documentElement
;
309 l
= 200 === b(h
.width
), g
.removeChild(e
)
315 if (e(), "string" == typeof a
&& (a
=
316 document
.querySelector(a
)), a
&& "object" == typeof a
&&
319 if ("none" === c
.display
) return d();
321 f
.width
= a
.offsetWidth
, f
.height
= a
.offsetHeight
;
322 for (var h
= f
.isBorderBox
= !(!k
|| !c
[k
] || "border-box"
323 !== c
[k
]), m
= 0, n
= g
.length
; n
> m
; m
++) {
327 var q
= parseFloat(p
);
328 f
[o
] = isNaN(q
) ? 0 : q
330 var r
= f
.paddingLeft
+ f
.paddingRight
,
331 s
= f
.paddingTop
+ f
.paddingBottom
,
332 t
= f
.marginLeft
+ f
.marginRight
,
333 u
= f
.marginTop
+ f
.marginBottom
,
334 v
= f
.borderLeftWidth
+ f
.borderRightWidth
,
335 w
= f
.borderTopWidth
+ f
.borderBottomWidth
,
338 y
!== !1 && (f
.width
= y
+ (x
? 0 : r
+ v
));
340 return z
!== !1 && (f
.height
= z
+ (x
? 0 : s
+ w
)),
341 f
.innerWidth
= f
.width
- (r
+ v
), f
.innerHeight
= f
.height
-
342 (s
+ w
), f
.outerWidth
= f
.width
+ t
, f
.outerHeight
=
348 if (a
.getComputedStyle
|| -1 === c
.indexOf("%")) return c
;
353 return g
&& (f
.left
= b
.currentStyle
.left
), d
.left
= c
, c
=
354 d
.pixelLeft
, d
.left
= e
, g
&& (f
.left
= g
), c
359 var f
= "undefined" == typeof console
? c : function(a
) {
362 g
= ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom",
363 "marginLeft", "marginRight", "marginTop", "marginBottom",
364 "borderLeftWidth", "borderRightWidth", "borderTopWidth",
365 "borderBottomWidth"];
366 "function" == typeof define
&& define
.amd
? define("get-size/get-size",
367 ["get-style-property/get-style-property"], e
) : "object" == typeof
368 exports
? module
.exports
= e(require("desandro-get-style-property")) :
369 a
.getSize
= e(a
.getStyleProperty
)
378 var b
= document
.createDocumentFragment();
385 for (var d
= a
.parentNode
.querySelectorAll(b
), e
= 0, f
= d
.length
;
387 if (d
[e
] === a
) return !0;
394 var f
, g = function() {
395 if (a
.matchesSelector
) return "matchesSelector";
396 for (var b
= ["webkit", "moz", "ms", "o"], c
= 0, d
= b
.length
; d
>
399 f
= e
+ "MatchesSelector";
404 var h
= document
.createElement("div"),
408 "function" == typeof define
&& define
.amd
?
409 define("matches-selector/matches-selector", [], function() {
411 }) : "object" == typeof exports
? module
.exports
= f
:
412 window
.matchesSelector
= f
413 }(Element
.prototype),
416 for (var c
in b
) a
[c
] = b
[c
];
421 for (var b
in a
) return !1;
426 return a
.replace(/([A-Z])/g, function(a
) {
427 return "-" + a
.toLowerCase()
431 function e(a
, e
, f
) {
433 a
&& (this.element
= a
, this.layout
= b
, this.position
= {
438 var i
= f("transition"),
441 l
= !!f("perspective"),
443 WebkitTransition
: "webkitTransitionEnd",
444 MozTransition
: "transitionend",
445 OTransition
: "otransitionend",
446 transition
: "transitionend"
448 n
= ["transform", "transition", "transitionDuration",
449 "transitionProperty"],
451 for (var a
= {}, b
= 0, c
= n
.length
; c
> b
; b
++) {
454 e
&& e
!== d
&& (a
[d
] = e
)
458 b(h
.prototype, a
.prototype), h
.prototype._create = function() {
466 }, h
.prototype.handleEvent = function(a
) {
467 var b
= "on" + a
.type
;
468 this[b
] && this[b
](a
)
469 }, h
.prototype.getSize = function() {
470 this.size
= e(this.element
)
471 }, h
.prototype.css = function(a
) {
472 var b
= this.element
.style
;
477 }, h
.prototype.getPosition = function() {
478 var a
= g(this.element
),
479 b
= this.layout
.options
,
482 e
= parseInt(a
[c
? "left" : "right"], 10),
483 f
= parseInt(a
[d
? "top" : "bottom"], 10);
484 e
= isNaN(e
) ? 0 : e
, f
= isNaN(f
) ? 0 : f
;
485 var h
= this.layout
.size
;
486 e
-= c
? h
.paddingLeft
: h
.paddingRight
, f
-= d
? h
.paddingTop
:
487 h
.paddingBottom
, this.position
.x
= e
, this.position
.y
= f
488 }, h
.prototype.layoutPosition = function() {
489 var a
= this.layout
.size
,
490 b
= this.layout
.options
,
492 b
.isOriginLeft
? (c
.left
= this.position
.x
+ a
.paddingLeft
+
493 "px", c
.right
= "") : (c
.right
= this.position
.x
+
494 a
.paddingRight
+ "px", c
.left
= ""), b
.isOriginTop
?
495 (c
.top
= this.position
.y
+ a
.paddingTop
+ "px", c
.bottom
=
496 "") : (c
.bottom
= this.position
.y
+ a
.paddingBottom
+ "px",
497 c
.top
= ""), this.css(c
), this.emitEvent("layout",
500 var p
= l
? function(a
, b
) {
501 return "translate3d(" + a
+ "px, " + b
+ "px, 0)"
503 return "translate(" + a
+ "px, " + b
+ "px)"
505 h
.prototype._transitionTo = function(a
, b
) {
507 var c
= this.position
.x
,
511 g
= e
=== this.position
.x
&& f
=== this.position
.y
;
512 if (this.setPosition(a
, b
), g
&& !this.isTransitioning
) return
513 void this.layoutPosition();
517 k
= this.layout
.options
;
518 h
= k
.isOriginLeft
? h
: -h
, i
= k
.isOriginTop
? i
: -i
,
519 j
.transform
= p(h
, i
), this.transition({
522 transform
: this.layoutPosition
526 }, h
.prototype.goTo = function(a
, b
) {
527 this.setPosition(a
, b
), this.layoutPosition()
528 }, h
.prototype.moveTo
= k
? h
.prototype._transitionTo
:
529 h
.prototype.goTo
, h
.prototype.setPosition = function(a
, b
) {
530 this.position
.x
= parseInt(a
, 10), this.position
.y
= parseInt(b
,
532 }, h
.prototype._nonTransition = function(a
) {
533 this.css(a
.to
), a
.isCleaning
&& this._removeStyles(a
.to
);
534 for (var b
in a
.onTransitionEnd
) a
.onTransitionEnd
[b
].call(this)
535 }, h
.prototype._transition = function(a
) {
536 if (!parseFloat(this.layout
.options
.transitionDuration
)) return
537 void this._nonTransition(a
);
538 var b
= this._transn
;
539 for (var c
in a
.onTransitionEnd
) b
.onEnd
[c
] =
540 a
.onTransitionEnd
[c
];
541 for (c
in a
.to
) b
.ingProperties
[c
] = !0, a
.isCleaning
&&
545 var d
= this.element
.offsetHeight
;
548 this.enableTransition(a
.to
), this.css(a
.to
),
549 this.isTransitioning
= !0
551 var q
= j
&& d(j
) + ",opacity";
552 h
.prototype.enableTransition = function() {
553 this.isTransitioning
|| (this.css({
554 transitionProperty
: q
,
555 transitionDuration
: this.layout
.options
.transitionDuration
556 }), this.element
.addEventListener(m
, this, !1))
557 }, h
.prototype.transition
= h
.prototype[i
? "_transition" :
558 "_nonTransition"], h
.prototype.onwebkitTransitionEnd = function(a
) {
559 this.ontransitionend(a
)
560 }, h
.prototype.onotransitionend = function(a
) {
561 this.ontransitionend(a
)
564 "-webkit-transform": "transform",
565 "-moz-transform": "transform",
566 "-o-transform": "transform"
568 h
.prototype.ontransitionend = function(a
) {
569 if (a
.target
=== this.element
) {
570 var b
= this._transn
,
571 d
= r
[a
.propertyName
] || a
.propertyName
;
572 if (delete b
.ingProperties
[d
], c(b
.ingProperties
) &&
573 this.disableTransition(), d
in b
.clean
&&
574 (this.element
.style
[a
.propertyName
] = "", delete
575 b
.clean
[d
]), d
in b
.onEnd
) {
577 e
.call(this), delete b
.onEnd
[d
]
579 this.emitEvent("transitionEnd", [this])
581 }, h
.prototype.disableTransition = function() {
582 this.removeTransitionStyles(),
583 this.element
.removeEventListener(m
, this, !1),
584 this.isTransitioning
= !1
585 }, h
.prototype._removeStyles = function(a
) {
587 for (var c
in a
) b
[c
] = "";
591 transitionProperty
: "",
592 transitionDuration
: ""
594 return h
.prototype.removeTransitionStyles = function() {
596 }, h
.prototype.removeElem = function() {
597 this.element
.parentNode
.removeChild(this.element
),
598 this.emitEvent("remove", [this])
599 }, h
.prototype.remove = function() {
600 if (!i
|| !parseFloat(this.layout
.options
.transitionDuration
))
601 return void this.removeElem();
603 this.on("transitionEnd", function() {
604 return a
.removeElem(), !0
606 }, h
.prototype.reveal = function() {
607 delete this.isHidden
, this.css({
610 var a
= this.layout
.options
;
616 }, h
.prototype.hide = function() {
617 this.isHidden
= !0, this.css({
620 var a
= this.layout
.options
;
622 from: a
.visibleStyle
,
626 opacity: function() {
627 this.isHidden
&& this.css({
633 }, h
.prototype.destroy = function() {
645 var f
= a
.getComputedStyle
,
646 g
= f
? function(a
) {
649 return a
.currentStyle
651 "function" == typeof define
&& define
.amd
? define("outlayer/item",
652 ["eventEmitter/EventEmitter", "get-size/get-size",
653 "get-style-property/get-style-property"], e
) : "object" == typeof
654 exports
? module
.exports
= e(require("wolfy87-eventemitter"),
655 require("get-size"), require("desandro-get-style-property")) :
656 (a
.Outlayer
= {}, a
.Outlayer
.Item
= e(a
.EventEmitter
, a
.getSize
,
661 for (var c
in b
) a
[c
] = b
[c
];
666 return "[object Array]" === l
.call(a
)
672 else if (a
&& "number" == typeof a
.length
)
673 for (var d
= 0, e
= a
.length
; e
> d
; d
++) b
.push(a
[d
]);
679 var c
= n(b
, a
); - 1 !== c
&& b
.splice(c
, 1)
683 return a
.replace(/(.)([A-Z])/g, function(a
, b
, c
) {
688 function g(c
, g
, l
, n
, o
, p
) {
690 if ("string" == typeof a
&& (a
= h
.querySelector(a
)), !a
||
691 !m(a
)) return void(i
&& i
.error("Bad " +
692 this.constructor.namespace + " element: " + a
));
693 this.element
= a
, this.options
= b({},
694 this.constructor.defaults
), this.option(c
);
696 this.element
.outlayerGUID
= d
, s
[d
] = this, this._create(),
697 this.options
.isInitLayout
&& this.layout()
701 return q
.namespace = "outlayer", q
.Item
= p
, q
.defaults
= {
709 isResizingContainer
: !0,
710 transitionDuration
: "0.4s",
713 transform
: "scale(0.001)"
717 transform
: "scale(1)"
719 }, b(q
.prototype, l
.prototype), q
.prototype.option = function(a
) {
721 }, q
.prototype._create = function() {
722 this.reloadItems(), this.stamps
= [],
723 this.stamp(this.options
.stamp
), b(this.element
.style
,
724 this.options
.containerStyle
), this.options
.isResizeBound
&&
726 }, q
.prototype.reloadItems = function() {
727 this.items
= this._itemize(this.element
.children
)
728 }, q
.prototype._itemize = function(a
) {
729 for (var b
= this._filterFindItemElements(a
), c
=
730 this.constructor.Item
, d
= [], e
= 0, f
= b
.length
; f
> e
;
737 }, q
.prototype._filterFindItemElements = function(a
) {
739 for (var b
= this.options
.itemSelector
, c
= [], e
= 0, f
=
740 a
.length
; f
> e
; e
++) {
744 o(g
, b
) && c
.push(g
);
745 for (var h
= g
.querySelectorAll(b
), i
= 0, j
=
746 h
.length
; j
> i
; i
++) c
.push(h
[i
])
750 }, q
.prototype.getItemElements = function() {
751 for (var a
= [], b
= 0, c
= this.items
.length
; c
> b
; b
++)
752 a
.push(this.items
[b
].element
);
754 }, q
.prototype.layout = function() {
755 this._resetLayout(), this._manageStamps();
756 var a
= void 0 !== this.options
.isLayoutInstant
?
757 this.options
.isLayoutInstant
: !this._isLayoutInited
;
758 this.layoutItems(this.items
, a
), this._isLayoutInited
= !0
759 }, q
.prototype._init
= q
.prototype.layout
, q
.prototype._resetLayout
762 }, q
.prototype.getSize = function() {
763 this.size
= n(this.element
)
764 }, q
.prototype._getMeasurement = function(a
, b
) {
765 var c
, d
= this.options
[a
];
766 d
? ("string" == typeof d
? c
= this.element
.querySelector(d
) :
767 m(d
) && (c
= d
), this[a
] = c
? n(c
)[b
] : d
) : this[a
] = 0
768 }, q
.prototype.layoutItems = function(a
, b
) {
769 a
= this._getItemsForLayout(a
), this._layoutItems(a
, b
),
771 }, q
.prototype._getItemsForLayout = function(a
) {
772 for (var b
= [], c
= 0, d
= a
.length
; d
> c
; c
++) {
774 e
.isIgnored
|| b
.push(e
)
777 }, q
.prototype._layoutItems = function(a
, b
) {
779 d
.emitEvent("layoutComplete", [d
, a
])
782 if (!a
|| !a
.length
) return void c();
783 this._itemsOn(a
, "layout", c
);
784 for (var e
= [], f
= 0, g
= a
.length
; g
> f
; f
++) {
786 i
= this._getItemLayoutPosition(h
);
787 i
.item
= h
, i
.isInstant
= b
|| h
.isLayoutInstant
, e
.push(i
)
789 this._processLayoutQueue(e
)
790 }, q
.prototype._getItemLayoutPosition = function() {
795 }, q
.prototype._processLayoutQueue = function(a
) {
796 for (var b
= 0, c
= a
.length
; c
> b
; b
++) {
798 this._positionItem(d
.item
, d
.x
, d
.y
, d
.isInstant
)
800 }, q
.prototype._positionItem = function(a
, b
, c
, d
) {
801 d
? a
.goTo(b
, c
) : a
.moveTo(b
, c
)
802 }, q
.prototype._postLayout = function() {
803 this.resizeContainer()
804 }, q
.prototype.resizeContainer = function() {
805 if (this.options
.isResizingContainer
) {
806 var a
= this._getContainerSize();
807 a
&& (this._setContainerMeasure(a
.width
, !0),
808 this._setContainerMeasure(a
.height
, !1))
810 }, q
.prototype._getContainerSize
= k
,
811 q
.prototype._setContainerMeasure = function(a
, b
) {
814 c
.isBorderBox
&& (a
+= b
? c
.paddingLeft
+ c
.paddingRight
+
815 c
.borderLeftWidth
+ c
.borderRightWidth
: c
.paddingBottom
816 + c
.paddingTop
+ c
.borderTopWidth
+
817 c
.borderBottomWidth
), a
= Math
.max(a
, 0),
818 this.element
.style
[b
? "width" : "height"] = a
+ "px"
820 }, q
.prototype._itemsOn = function(a
, b
, c
) {
822 return e
++, e
=== f
&& c
.call(g
), !0
824 for (var e
= 0, f
= a
.length
, g
= this, h
= 0, i
= a
.length
; i
>
829 }, q
.prototype.ignore = function(a
) {
830 var b
= this.getItem(a
);
831 b
&& (b
.isIgnored
= !0)
832 }, q
.prototype.unignore = function(a
) {
833 var b
= this.getItem(a
);
834 b
&& delete b
.isIgnored
835 }, q
.prototype.stamp = function(a
) {
836 if (a
= this._find(a
)) {
837 this.stamps
= this.stamps
.concat(a
);
838 for (var b
= 0, c
= a
.length
; c
> b
; b
++) {
843 }, q
.prototype.unstamp = function(a
) {
844 if (a
= this._find(a
))
845 for (var b
= 0, c
= a
.length
; c
> b
; b
++) {
847 e(d
, this.stamps
), this.unignore(d
)
849 }, q
.prototype._find = function(a
) {
850 return a
? ("string" == typeof a
&& (a
=
851 this.element
.querySelectorAll(a
)), a
= d(a
)) : void 0
852 }, q
.prototype._manageStamps = function() {
853 if (this.stamps
&& this.stamps
.length
) {
854 this._getBoundingRect();
855 for (var a
= 0, b
= this.stamps
.length
; b
> a
; a
++) {
856 var c
= this.stamps
[a
];
860 }, q
.prototype._getBoundingRect = function() {
861 var a
= this.element
.getBoundingClientRect(),
863 this._boundingRect
= {
864 left
: a
.left
+ b
.paddingLeft
+ b
.borderLeftWidth
,
865 top
: a
.top
+ b
.paddingTop
+ b
.borderTopWidth
,
866 right
: a
.right
- (b
.paddingRight
+ b
.borderRightWidth
),
867 bottom
: a
.bottom
- (b
.paddingBottom
+ b
.borderBottomWidth
)
869 }, q
.prototype._manageStamp
= k
, q
.prototype._getElementOffset
=
871 var b
= a
.getBoundingClientRect(),
872 c
= this._boundingRect
,
875 left
: b
.left
- c
.left
- d
.marginLeft
,
876 top
: b
.top
- c
.top
- d
.marginTop
,
877 right
: c
.right
- b
.right
- d
.marginRight
,
878 bottom
: c
.bottom
- b
.bottom
- d
.marginBottom
881 }, q
.prototype.handleEvent = function(a
) {
882 var b
= "on" + a
.type
;
883 this[b
] && this[b
](a
)
884 }, q
.prototype.bindResize = function() {
885 this.isResizeBound
|| (c
.bind(a
, "resize", this),
886 this.isResizeBound
= !0)
887 }, q
.prototype.unbindResize = function() {
888 this.isResizeBound
&& c
.unbind(a
, "resize", this),
889 this.isResizeBound
= !1
890 }, q
.prototype.onresize = function() {
892 b
.resize(), delete b
.resizeTimeout
894 this.resizeTimeout
&& clearTimeout(this.resizeTimeout
);
896 this.resizeTimeout
= setTimeout(a
, 100)
897 }, q
.prototype.resize = function() {
898 this.isResizeBound
&& this.needsResizeLayout() && this.layout()
899 }, q
.prototype.needsResizeLayout = function() {
900 var a
= n(this.element
),
902 return b
&& a
.innerWidth
!== this.size
.innerWidth
903 }, q
.prototype.addItems = function(a
) {
904 var b
= this._itemize(a
);
905 return b
.length
&& (this.items
= this.items
.concat(b
)), b
906 }, q
.prototype.appended = function(a
) {
907 var b
= this.addItems(a
);
908 b
.length
&& (this.layoutItems(b
, !0), this.reveal(b
))
909 }, q
.prototype.prepended = function(a
) {
910 var b
= this._itemize(a
);
912 var c
= this.items
.slice(0);
913 this.items
= b
.concat(c
), this._resetLayout(),
914 this._manageStamps(), this.layoutItems(b
, !0),
915 this.reveal(b
), this.layoutItems(c
)
917 }, q
.prototype.reveal = function(a
) {
918 var b
= a
&& a
.length
;
920 for (var c
= 0; b
> c
; c
++) {
924 }, q
.prototype.hide = function(a
) {
925 var b
= a
&& a
.length
;
927 for (var c
= 0; b
> c
; c
++) {
931 }, q
.prototype.getItem = function(a
) {
932 for (var b
= 0, c
= this.items
.length
; c
> b
; b
++) {
933 var d
= this.items
[b
];
934 if (d
.element
=== a
) return d
936 }, q
.prototype.getItems = function(a
) {
938 for (var b
= [], c
= 0, d
= a
.length
; d
> c
; c
++) {
945 }, q
.prototype.remove = function(a
) {
947 var b
= this.getItems(a
);
949 this._itemsOn(b
, "remove", function() {
950 this.emitEvent("removeComplete", [this, b
])
952 for (var c
= 0, f
= b
.length
; f
> c
; c
++) {
954 g
.remove(), e(g
, this.items
)
957 }, q
.prototype.destroy = function() {
958 var a
= this.element
.style
;
959 a
.height
= "", a
.position
= "", a
.width
= "";
960 for (var b
= 0, c
= this.items
.length
; c
> b
; b
++) {
961 var d
= this.items
[b
];
965 var e
= this.element
.outlayerGUID
;
966 delete s
[e
], delete this.element
.outlayerGUID
, j
&&
967 j
.removeData(this.element
, this.constructor.namespace)
968 }, q
.data = function(a
) {
969 var b
= a
&& a
.outlayerGUID
;
971 }, q
.create = function(a
, c
) {
973 q
.apply(this, arguments
)
975 return Object
.create
? d
.prototype = Object
.create(q
.prototype)
976 : b(d
.prototype, q
.prototype), d
.prototype.constructor = d
,
977 d
.defaults
= b({}, q
.defaults
), b(d
.defaults
, c
),
978 d
.prototype.settings
= {}, d
.namespace = a
, d
.data
= q
.data
,
979 d
.Item = function() {
980 p
.apply(this, arguments
)
981 }, d
.Item
.prototype = new p
, g(function() {
982 for (var b
= f(a
), c
= h
.querySelectorAll(".js-" + b
), e
=
983 "data-" + b
+ "-options", g
= 0, k
= c
.length
; k
> g
;
986 n
= m
.getAttribute(e
);
988 l
= n
&& JSON
.parse(n
)
990 i
&& i
.error("Error parsing " + e
+ " on " +
991 m
.nodeName
.toLowerCase() + (m
.id
? "#" + m
.id
:
998 }), j
&& j
.bridget
&& j
.bridget(a
, d
), d
1005 l
= Object
.prototype.toString
,
1006 m
= "function" == typeof HTMLElement
|| "object" == typeof
1007 HTMLElement
? function(a
) {
1008 return a
instanceof HTMLElement
1010 return a
&& "object" == typeof a
&& 1 === a
.nodeType
&& "string"
1011 == typeof a
.nodeName
1013 n
= Array
.prototype.indexOf
? function(a
, b
) {
1015 } : function(a
, b
) {
1016 for (var c
= 0, d
= a
.length
; d
> c
; c
++)
1017 if (a
[c
] === b
) return c
;
1020 "function" == typeof define
&& define
.amd
? define("outlayer/outlayer",
1021 ["eventie/eventie", "doc-ready/doc-ready",
1022 "eventEmitter/EventEmitter", "get-size/get-size",
1023 "matches-selector/matches-selector", "./item"], g
) : "object" ==
1024 typeof exports
? module
.exports
= g(require("eventie"),
1025 require("doc-ready"), require("wolfy87-eventemitter"),
1026 require("get-size"), require("desandro-matches-selector"),
1027 require("./item")) : a
.Outlayer
= g(a
.eventie
, a
.docReady
,
1028 a
.EventEmitter
, a
.getSize
, a
.matchesSelector
, a
.Outlayer
.Item
)
1032 var d
= a
.create("masonry");
1033 return d
.prototype._resetLayout = function() {
1034 this.getSize(), this._getMeasurement("columnWidth",
1035 "outerWidth"), this._getMeasurement("gutter", "outerWidth"),
1036 this.measureColumns();
1038 for (this.colYs
= []; a
--;) this.colYs
.push(0);
1040 }, d
.prototype.measureColumns = function() {
1041 if (this.getContainerWidth(), !this.columnWidth
) {
1042 var a
= this.items
[0],
1044 this.columnWidth
= c
&& b(c
).outerWidth
||
1047 this.columnWidth
+= this.gutter
, this.cols
=
1048 Math
.floor((this.containerWidth
+ this.gutter
) /
1049 this.columnWidth
), this.cols
= Math
.max(this.cols
, 1)
1050 }, d
.prototype.getContainerWidth = function() {
1051 var a
= this.options
.isFitWidth
? this.element
.parentNode
:
1054 this.containerWidth
= c
&& c
.innerWidth
1055 }, d
.prototype._getItemLayoutPosition = function(a
) {
1057 var b
= a
.size
.outerWidth
% this.columnWidth
,
1058 d
= b
&& 1 > b
? "round" : "ceil",
1059 e
= Math
[d
](a
.size
.outerWidth
/ this.columnWidth
);
1060 e
= Math
.min(e
, this.cols
);
1061 for (var f
= this._getColGroup(e
), g
= Math
.min
.apply(Math
, f
),
1063 x
: this.columnWidth
* h
,
1065 }, j
= g
+ a
.size
.outerHeight
, k
= this.cols
+ 1 - f
.length
,
1066 l
= 0; k
> l
; l
++) this.colYs
[h
+ l
] = j
;
1068 }, d
.prototype._getColGroup = function(a
) {
1069 if (2 > a
) return this.colYs
;
1070 for (var b
= [], c
= this.cols
+ 1 - a
, d
= 0; c
> d
; d
++) {
1071 var e
= this.colYs
.slice(d
, d
+ a
);
1072 b
[d
] = Math
.max
.apply(Math
, e
)
1075 }, d
.prototype._manageStamp = function(a
) {
1077 d
= this._getElementOffset(a
),
1078 e
= this.options
.isOriginLeft
? d
.left
: d
.right
,
1079 f
= e
+ c
.outerWidth
,
1080 g
= Math
.floor(e
/ this.columnWidth
);
1082 var h
= Math
.floor(f
/ this.columnWidth
);
1083 h
-= f
% this.columnWidth
? 0 : 1, h
= Math
.min(this.cols
- 1,
1085 for (var i
= (this.options
.isOriginTop
? d
.top
: d
.bottom
) +
1086 c
.outerHeight
, j
= g
; h
>= j
; j
++) this.colYs
[j
] =
1087 Math
.max(i
, this.colYs
[j
])
1088 }, d
.prototype._getContainerSize = function() {
1089 this.maxY
= Math
.max
.apply(Math
, this.colYs
);
1093 return this.options
.isFitWidth
&& (a
.width
=
1094 this._getContainerFitWidth()), a
1095 }, d
.prototype._getContainerFitWidth = function() {
1096 for (var a
= 0, b
= this.cols
; --b
&& 0 === this.colYs
[b
];) a
++;
1097 return (this.cols
- a
) * this.columnWidth
- this.gutter
1098 }, d
.prototype.needsResizeLayout = function() {
1099 var a
= this.containerWidth
;
1100 return this.getContainerWidth(), a
!== this.containerWidth
1103 var c
= Array
.prototype.indexOf
? function(a
, b
) {
1105 } : function(a
, b
) {
1106 for (var c
= 0, d
= a
.length
; d
> c
; c
++) {
1108 if (e
=== b
) return c
1112 "function" == typeof define
&& define
.amd
? define(["outlayer/outlayer",
1113 "get-size/get-size"], b
) : "object" == typeof exports
?
1114 module
.exports
= b(require("outlayer"), require("get-size")) :
1115 a
.Masonry
= b(a
.Outlayer
, a
.getSize
)
1117 var container
= document
.querySelector('#container');
1118 var item
= container
.children
[0];
1119 for (var i
= 0; i
< 20; ++i
) {
1120 container
.appendChild(item
.cloneNode(true));
1122 document
.body
.style
.display
= 'block';
1123 window
.done
= false;
1124 window
.brick = function() {
1125 var mason
= new Masonry(container
, {
1126 itemSelector
: '.item',
1128 function relayout(i
) {
1133 requestAnimationFrame(function() {
1134 mason
.element
.style
.maxWidth
= '950px';
1136 requestAnimationFrame(function() {
1137 mason
.element
.style
.maxWidth
= '200px';
1139 requestAnimationFrame(function() {