Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: tools/perf/page_sets/key_silk_cases/masonry.js

Issue 1017683004: CL for perf tryjob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/page_sets/key_silk_cases/masonry.html ('k') | tools/run-perf-test.cfg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*!
2 * Masonry PACKAGED v3.2.2
3 * Cascading grid layout library
4 * http://masonry.desandro.com
5 * MIT License
6 * by David DeSandro
7 */
8 ! function(a) {
9 function b() {}
10
11 function c(a) {
12 function c(b) {
13 b.prototype.option || (b.prototype.option = function(b) {
14 a.isPlainObject(b) && (this.options = a.extend(!0, this.options,
15 b))
16 })
17 }
18
19 function e(b, c) {
20 a.fn[b] = function(e) {
21 if ("string" == typeof e) {
22 for (var g = d.call(arguments, 1), h = 0, i = this.length; i
23 > h; h++) {
24 var j = this[h],
25 k = a.data(j, b);
26 if (k)
27 if (a.isFunction(k[e]) && "_" !== e.charAt(0)) {
28 var l = k[e].apply(k, g);
29 if (void 0 !== l) return l
30 } else f("no such method '" + e + "' for " + b +
31 " instance");
32 else f("cannot call methods on " + b +
33 " prior to initialization; attempted to call '" +
34 e + "'")
35 }
36 return this
37 }
38 return this.each(function() {
39 var d = a.data(this, b);
40 d ? (d.option(e), d._init()) : (d = new c(this, e),
41 a.data(this, b, d))
42 })
43 }
44 }
45 if (a) {
46 var f = "undefined" == typeof console ? b : function(a) {
47 console.error(a)
48 };
49 return a.bridget = function(a, b) {
50 c(b), e(a, b)
51 }, a.bridget
52 }
53 }
54 var d = Array.prototype.slice;
55 "function" == typeof define && define.amd ?
56 define("jquery-bridget/jquery.bridget", ["jquery"], c) : c("object" ==
57 typeof exports ? require("jquery") : a.jQuery)
58 }(window),
59 function(a) {
60 function b(b) {
61 var c = a.event;
62 return c.target = c.target || c.srcElement || b, c
63 }
64 var c = document.documentElement,
65 d = function() {};
66 c.addEventListener ? d = function(a, b, c) {
67 a.addEventListener(b, c, !1)
68 } : c.attachEvent && (d = function(a, c, d) {
69 a[c + d] = d.handleEvent ? function() {
70 var c = b(a);
71 d.handleEvent.call(d, c)
72 } : function() {
73 var c = b(a);
74 d.call(a, c)
75 }, a.attachEvent("on" + c, a[c + d])
76 });
77 var e = function() {};
78 c.removeEventListener ? e = function(a, b, c) {
79 a.removeEventListener(b, c, !1)
80 } : c.detachEvent && (e = function(a, b, c) {
81 a.detachEvent("on" + b, a[b + c]);
82 try {
83 delete a[b + c]
84 } catch (d) {
85 a[b + c] = void 0
86 }
87 });
88 var f = {
89 bind: d,
90 unbind: e
91 };
92 "function" == typeof define && define.amd ? define("eventie/eventie", f) :
93 "object" == typeof exports ? module.exports = f : a.eventie = f
94 }(this),
95 function(a) {
96 function b(a) {
97 "function" == typeof a && (b.isReady ? a() : g.push(a))
98 }
99
100 function c(a) {
101 var c = "readystatechange" === a.type && "complete" !== f.readyState;
102 b.isReady || c || d()
103 }
104
105 function d() {
106 b.isReady = !0;
107 for (var a = 0, c = g.length; c > a; a++) {
108 var d = g[a];
109 d()
110 }
111 }
112
113 function e(e) {
114 return "complete" === f.readyState ? d() : (e.bind(f,
115 "DOMContentLoaded", c), e.bind(f, "readystatechange", c),
116 e.bind(a, "load", c)), b
117 }
118 var f = a.document,
119 g = [];
120 b.isReady = !1, "function" == typeof define && define.amd ?
121 define("doc-ready/doc-ready", ["eventie/eventie"], e) : "object" == typeof
122 exports ? module.exports = e(require("eventie")) : a.docReady =
123 e(a.eventie)
124 }(window),
125 function() {
126 function a() {}
127
128 function b(a, b) {
129 for (var c = a.length; c--;)
130 if (a[c].listener === b) return c;
131 return -1
132 }
133
134 function c(a) {
135 return function() {
136 return this[a].apply(this, arguments)
137 }
138 }
139 var d = a.prototype,
140 e = this,
141 f = e.EventEmitter;
142 d.getListeners = function(a) {
143 var b, c, d = this._getEvents();
144 if (a instanceof RegExp) {
145 b = {};
146 for (c in d) d.hasOwnProperty(c) && a.test(c) && (b[c] = d[c])
147 } else b = d[a] || (d[a] = []);
148 return b
149 }, d.flattenListeners = function(a) {
150 var b, c = [];
151 for (b = 0; b < a.length; b += 1) c.push(a[b].listener);
152 return c
153 }, d.getListenersAsObject = function(a) {
154 var b, c = this.getListeners(a);
155 return c instanceof Array && (b = {}, b[a] = c), b || c
156 }, d.addListener = function(a, c) {
157 var d, e = this.getListenersAsObject(a),
158 f = "object" == typeof c;
159 for (d in e) e.hasOwnProperty(d) && -1 === b(e[d], c) && e[d].push(f ? c
160 : {
161 listener: c,
162 once: !1
163 });
164 return this
165 }, d.on = c("addListener"), d.addOnceListener = function(a, b) {
166 return this.addListener(a, {
167 listener: b,
168 once: !0
169 })
170 }, d.once = c("addOnceListener"), d.defineEvent = function(a) {
171 return this.getListeners(a), this
172 }, d.defineEvents = function(a) {
173 for (var b = 0; b < a.length; b += 1) this.defineEvent(a[b]);
174 return this
175 }, d.removeListener = function(a, c) {
176 var d, e, f = this.getListenersAsObject(a);
177 for (e in f) f.hasOwnProperty(e) && (d = b(f[e], c), -1 !== d &&
178 f[e].splice(d, 1));
179 return this
180 }, d.off = c("removeListener"), d.addListeners = function(a, b) {
181 return this.manipulateListeners(!1, a, b)
182 }, d.removeListeners = function(a, b) {
183 return this.manipulateListeners(!0, a, b)
184 }, d.manipulateListeners = function(a, b, c) {
185 var d, e, f = a ? this.removeListener : this.addListener,
186 g = a ? this.removeListeners : this.addListeners;
187 if ("object" != typeof b || b instanceof RegExp)
188 for (d = c.length; d--;) f.call(this, b, c[d]);
189 else
190 for (d in b) b.hasOwnProperty(d) && (e = b[d]) && ("function" ==
191 typeof e ? f.call(this, d, e) : g.call(this, d, e));
192 return this
193 }, d.removeEvent = function(a) {
194 var b, c = typeof a,
195 d = this._getEvents();
196 if ("string" === c) delete d[a];
197 else if (a instanceof RegExp)
198 for (b in d) d.hasOwnProperty(b) && a.test(b) && delete d[b];
199 else delete this._events;
200 return this
201 }, d.removeAllListeners = c("removeEvent"), d.emitEvent = function(a, b) {
202 var c, d, e, f, g = this.getListenersAsObject(a);
203 for (e in g)
204 if (g.hasOwnProperty(e))
205 for (d = g[e].length; d--;) c = g[e][d], c.once === !0 &&
206 this.removeListener(a, c.listener), f = c.listener.apply(this,
207 b || []), f === this._getOnceReturnValue() &&
208 this.removeListener(a, c.listener);
209 return this
210 }, d.trigger = c("emitEvent"), d.emit = function(a) {
211 var b = Array.prototype.slice.call(arguments, 1);
212 return this.emitEvent(a, b)
213 }, d.setOnceReturnValue = function(a) {
214 return this._onceReturnValue = a, this
215 }, d._getOnceReturnValue = function() {
216 return this.hasOwnProperty("_onceReturnValue") ? this._onceReturnValue :
217 !0
218 }, d._getEvents = function() {
219 return this._events || (this._events = {})
220 }, a.noConflict = function() {
221 return e.EventEmitter = f, a
222 }, "function" == typeof define && define.amd ?
223 define("eventEmitter/EventEmitter", [], function() {
224 return a
225 }) : "object" == typeof module && module.exports ? module.exports = a :
226 e.EventEmitter = a
227 }.call(this),
228 function(a) {
229 function b(a) {
230 if (a) {
231 if ("string" == typeof d[a]) return a;
232 a = a.charAt(0).toUpperCase() + a.slice(1);
233 for (var b, e = 0, f = c.length; f > e; e++)
234 if (b = c[e] + a, "string" == typeof d[b]) return b
235 }
236 }
237 var c = "Webkit Moz ms Ms O".split(" "),
238 d = document.documentElement.style;
239 "function" == typeof define && define.amd ?
240 define("get-style-property/get-style-property", [], function() {
241 return b
242 }) : "object" == typeof exports ? module.exports = b :
243 a.getStyleProperty = b
244 }(window),
245 function(a) {
246 function b(a) {
247 var b = parseFloat(a),
248 c = -1 === a.indexOf("%") && !isNaN(b);
249 return c && b
250 }
251
252 function c() {}
253
254 function d() {
255 for (var a = {
256 width: 0,
257 height: 0,
258 innerWidth: 0,
259 innerHeight: 0,
260 outerWidth: 0,
261 outerHeight: 0
262 }, b = 0, c = g.length; c > b; b++) {
263 var d = g[b];
264 a[d] = 0
265 }
266 return a
267 }
268
269 function e(c) {
270 function e() {
271 if (!m) {
272 m = !0;
273 var d = a.getComputedStyle;
274 if (j = function() {
275 var a = d ? function(a) {
276 return d(a, null)
277 } : function(a) {
278 return a.currentStyle
279 };
280 return function(b) {
281 var c = a(b);
282 return c || f("Style returned " + c), c
283 }
284 }(), k = c("boxSizing")) {
285 var e = document.createElement("div");
286 e.style.width = "200px",
287 e.style.padding = "1px 2px 3px 4px",
288 e.style.borderStyle = "solid",
289 e.style.borderWidth = "1px 2px 3px 4px", e.style[k] =
290 "border-box";
291 var g = document.body || document.documentElement;
292 g.appendChild(e);
293 var h = j(e);
294 l = 200 === b(h.width), g.removeChild(e)
295 }
296 }
297 }
298
299 function h(a) {
300 if (e(), "string" == typeof a && (a =
301 document.querySelector(a)), a && "object" == typeof a &&
302 a.nodeType) {
303 var c = j(a);
304 if ("none" === c.display) return d();
305 var f = {};
306 f.width = a.offsetWidth, f.height = a.offsetHeight;
307 for (var h = f.isBorderBox = !(!k || !c[k] || "border-box"
308 !== c[k]), m = 0, n = g.length; n > m; m++) {
309 var o = g[m],
310 p = c[o];
311 p = i(a, p);
312 var q = parseFloat(p);
313 f[o] = isNaN(q) ? 0 : q
314 }
315 var r = f.paddingLeft + f.paddingRight,
316 s = f.paddingTop + f.paddingBottom,
317 t = f.marginLeft + f.marginRight,
318 u = f.marginTop + f.marginBottom,
319 v = f.borderLeftWidth + f.borderRightWidth,
320 w = f.borderTopWidth + f.borderBottomWidth,
321 x = h && l,
322 y = b(c.width);
323 y !== !1 && (f.width = y + (x ? 0 : r + v));
324 var z = b(c.height);
325 return z !== !1 && (f.height = z + (x ? 0 : s + w)),
326 f.innerWidth = f.width - (r + v), f.innerHeight = f.height -
327 (s + w), f.outerWidth = f.width + t, f.outerHeight =
328 f.height + u, f
329 }
330 }
331
332 function i(b, c) {
333 if (a.getComputedStyle || -1 === c.indexOf("%")) return c;
334 var d = b.style,
335 e = d.left,
336 f = b.runtimeStyle,
337 g = f && f.left;
338 return g && (f.left = b.currentStyle.left), d.left = c, c =
339 d.pixelLeft, d.left = e, g && (f.left = g), c
340 }
341 var j, k, l, m = !1;
342 return h
343 }
344 var f = "undefined" == typeof console ? c : function(a) {
345 console.error(a)
346 },
347 g = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom",
348 "marginLeft", "marginRight", "marginTop", "marginBottom",
349 "borderLeftWidth", "borderRightWidth", "borderTopWidth",
350 "borderBottomWidth"];
351 "function" == typeof define && define.amd ? define("get-size/get-size",
352 ["get-style-property/get-style-property"], e) : "object" == typeof
353 exports ? module.exports = e(require("desandro-get-style-property")) :
354 a.getSize = e(a.getStyleProperty)
355 }(window),
356 function(a) {
357 function b(a, b) {
358 return a[g](b)
359 }
360
361 function c(a) {
362 if (!a.parentNode) {
363 var b = document.createDocumentFragment();
364 b.appendChild(a)
365 }
366 }
367
368 function d(a, b) {
369 c(a);
370 for (var d = a.parentNode.querySelectorAll(b), e = 0, f = d.length;
371 f > e; e++)
372 if (d[e] === a) return !0;
373 return !1
374 }
375
376 function e(a, d) {
377 return c(a), b(a, d)
378 }
379 var f, g = function() {
380 if (a.matchesSelector) return "matchesSelector";
381 for (var b = ["webkit", "moz", "ms", "o"], c = 0, d = b.length; d >
382 c; c++) {
383 var e = b[c],
384 f = e + "MatchesSelector";
385 if (a[f]) return f
386 }
387 }();
388 if (g) {
389 var h = document.createElement("div"),
390 i = b(h, "div");
391 f = i ? b : e
392 } else f = d;
393 "function" == typeof define && define.amd ?
394 define("matches-selector/matches-selector", [], function() {
395 return f
396 }) : "object" == typeof exports ? module.exports = f :
397 window.matchesSelector = f
398 }(Element.prototype),
399 function(a) {
400 function b(a, b) {
401 for (var c in b) a[c] = b[c];
402 return a
403 }
404
405 function c(a) {
406 for (var b in a) return !1;
407 return b = null, !0
408 }
409
410 function d(a) {
411 return a.replace(/([A-Z])/g, function(a) {
412 return "-" + a.toLowerCase()
413 })
414 }
415
416 function e(a, e, f) {
417 function h(a, b) {
418 a && (this.element = a, this.layout = b, this.position = {
419 x: 0,
420 y: 0
421 }, this._create())
422 }
423 var i = f("transition"),
424 j = f("transform"),
425 k = i && j,
426 l = !!f("perspective"),
427 m = {
428 WebkitTransition: "webkitTransitionEnd",
429 MozTransition: "transitionend",
430 OTransition: "otransitionend",
431 transition: "transitionend"
432 }[i],
433 n = ["transform", "transition", "transitionDuration",
434 "transitionProperty"],
435 o = function() {
436 for (var a = {}, b = 0, c = n.length; c > b; b++) {
437 var d = n[b],
438 e = f(d);
439 e && e !== d && (a[d] = e)
440 }
441 return a
442 }();
443 b(h.prototype, a.prototype), h.prototype._create = function() {
444 this._transn = {
445 ingProperties: {},
446 clean: {},
447 onEnd: {}
448 }, this.css({
449 position: "absolute"
450 })
451 }, h.prototype.handleEvent = function(a) {
452 var b = "on" + a.type;
453 this[b] && this[b](a)
454 }, h.prototype.getSize = function() {
455 this.size = e(this.element)
456 }, h.prototype.css = function(a) {
457 var b = this.element.style;
458 for (var c in a) {
459 var d = o[c] || c;
460 b[d] = a[c]
461 }
462 }, h.prototype.getPosition = function() {
463 var a = g(this.element),
464 b = this.layout.options,
465 c = b.isOriginLeft,
466 d = b.isOriginTop,
467 e = parseInt(a[c ? "left" : "right"], 10),
468 f = parseInt(a[d ? "top" : "bottom"], 10);
469 e = isNaN(e) ? 0 : e, f = isNaN(f) ? 0 : f;
470 var h = this.layout.size;
471 e -= c ? h.paddingLeft : h.paddingRight, f -= d ? h.paddingTop :
472 h.paddingBottom, this.position.x = e, this.position.y = f
473 }, h.prototype.layoutPosition = function() {
474 var a = this.layout.size,
475 b = this.layout.options,
476 c = {};
477 b.isOriginLeft ? (c.left = this.position.x + a.paddingLeft +
478 "px", c.right = "") : (c.right = this.position.x +
479 a.paddingRight + "px", c.left = ""), b.isOriginTop ?
480 (c.top = this.position.y + a.paddingTop + "px", c.bottom =
481 "") : (c.bottom = this.position.y + a.paddingBottom + "px",
482 c.top = ""), this.css(c), this.emitEvent("layout",
483 [this])
484 };
485 var p = l ? function(a, b) {
486 return "translate3d(" + a + "px, " + b + "px, 0)"
487 } : function(a, b) {
488 return "translate(" + a + "px, " + b + "px)"
489 };
490 h.prototype._transitionTo = function(a, b) {
491 this.getPosition();
492 var c = this.position.x,
493 d = this.position.y,
494 e = parseInt(a, 10),
495 f = parseInt(b, 10),
496 g = e === this.position.x && f === this.position.y;
497 if (this.setPosition(a, b), g && !this.isTransitioning) return
498 void this.layoutPosition();
499 var h = a - c,
500 i = b - d,
501 j = {},
502 k = this.layout.options;
503 h = k.isOriginLeft ? h : -h, i = k.isOriginTop ? i : -i,
504 j.transform = p(h, i), this.transition({
505 to: j,
506 onTransitionEnd: {
507 transform: this.layoutPosition
508 },
509 isCleaning: !0
510 })
511 }, h.prototype.goTo = function(a, b) {
512 this.setPosition(a, b), this.layoutPosition()
513 }, h.prototype.moveTo = k ? h.prototype._transitionTo :
514 h.prototype.goTo, h.prototype.setPosition = function(a, b) {
515 this.position.x = parseInt(a, 10), this.position.y = parseInt(b,
516 10)
517 }, h.prototype._nonTransition = function(a) {
518 this.css(a.to), a.isCleaning && this._removeStyles(a.to);
519 for (var b in a.onTransitionEnd) a.onTransitionEnd[b].call(this)
520 }, h.prototype._transition = function(a) {
521 if (!parseFloat(this.layout.options.transitionDuration)) return
522 void this._nonTransition(a);
523 var b = this._transn;
524 for (var c in a.onTransitionEnd) b.onEnd[c] =
525 a.onTransitionEnd[c];
526 for (c in a.to) b.ingProperties[c] = !0, a.isCleaning &&
527 (b.clean[c] = !0);
528 if (a.from) {
529 this.css(a.from);
530 var d = this.element.offsetHeight;
531 d = null
532 }
533 this.enableTransition(a.to), this.css(a.to),
534 this.isTransitioning = !0
535 };
536 var q = j && d(j) + ",opacity";
537 h.prototype.enableTransition = function() {
538 this.isTransitioning || (this.css({
539 transitionProperty: q,
540 transitionDuration: this.layout.options.transitionDuration
541 }), this.element.addEventListener(m, this, !1))
542 }, h.prototype.transition = h.prototype[i ? "_transition" :
543 "_nonTransition"], h.prototype.onwebkitTransitionEnd = function(a) {
544 this.ontransitionend(a)
545 }, h.prototype.onotransitionend = function(a) {
546 this.ontransitionend(a)
547 };
548 var r = {
549 "-webkit-transform": "transform",
550 "-moz-transform": "transform",
551 "-o-transform": "transform"
552 };
553 h.prototype.ontransitionend = function(a) {
554 if (a.target === this.element) {
555 var b = this._transn,
556 d = r[a.propertyName] || a.propertyName;
557 if (delete b.ingProperties[d], c(b.ingProperties) &&
558 this.disableTransition(), d in b.clean &&
559 (this.element.style[a.propertyName] = "", delete
560 b.clean[d]), d in b.onEnd) {
561 var e = b.onEnd[d];
562 e.call(this), delete b.onEnd[d]
563 }
564 this.emitEvent("transitionEnd", [this])
565 }
566 }, h.prototype.disableTransition = function() {
567 this.removeTransitionStyles(),
568 this.element.removeEventListener(m, this, !1),
569 this.isTransitioning = !1
570 }, h.prototype._removeStyles = function(a) {
571 var b = {};
572 for (var c in a) b[c] = "";
573 this.css(b)
574 };
575 var s = {
576 transitionProperty: "",
577 transitionDuration: ""
578 };
579 return h.prototype.removeTransitionStyles = function() {
580 this.css(s)
581 }, h.prototype.removeElem = function() {
582 this.element.parentNode.removeChild(this.element),
583 this.emitEvent("remove", [this])
584 }, h.prototype.remove = function() {
585 if (!i || !parseFloat(this.layout.options.transitionDuration))
586 return void this.removeElem();
587 var a = this;
588 this.on("transitionEnd", function() {
589 return a.removeElem(), !0
590 }), this.hide()
591 }, h.prototype.reveal = function() {
592 delete this.isHidden, this.css({
593 display: ""
594 });
595 var a = this.layout.options;
596 this.transition({
597 from: a.hiddenStyle,
598 to: a.visibleStyle,
599 isCleaning: !0
600 })
601 }, h.prototype.hide = function() {
602 this.isHidden = !0, this.css({
603 display: ""
604 });
605 var a = this.layout.options;
606 this.transition({
607 from: a.visibleStyle,
608 to: a.hiddenStyle,
609 isCleaning: !0,
610 onTransitionEnd: {
611 opacity: function() {
612 this.isHidden && this.css({
613 display: "none"
614 })
615 }
616 }
617 })
618 }, h.prototype.destroy = function() {
619 this.css({
620 position: "",
621 left: "",
622 right: "",
623 top: "",
624 bottom: "",
625 transition: "",
626 transform: ""
627 })
628 }, h
629 }
630 var f = a.getComputedStyle,
631 g = f ? function(a) {
632 return f(a, null)
633 } : function(a) {
634 return a.currentStyle
635 };
636 "function" == typeof define && define.amd ? define("outlayer/item",
637 ["eventEmitter/EventEmitter", "get-size/get-size",
638 "get-style-property/get-style-property"], e) : "object" == typeof
639 exports ? module.exports = e(require("wolfy87-eventemitter"),
640 require("get-size"), require("desandro-get-style-property")) :
641 (a.Outlayer = {}, a.Outlayer.Item = e(a.EventEmitter, a.getSize,
642 a.getStyleProperty))
643 }(window),
644 function(a) {
645 function b(a, b) {
646 for (var c in b) a[c] = b[c];
647 return a
648 }
649
650 function c(a) {
651 return "[object Array]" === l.call(a)
652 }
653
654 function d(a) {
655 var b = [];
656 if (c(a)) b = a;
657 else if (a && "number" == typeof a.length)
658 for (var d = 0, e = a.length; e > d; d++) b.push(a[d]);
659 else b.push(a);
660 return b
661 }
662
663 function e(a, b) {
664 var c = n(b, a); - 1 !== c && b.splice(c, 1)
665 }
666
667 function f(a) {
668 return a.replace(/(.)([A-Z])/g, function(a, b, c) {
669 return b + "-" + c
670 }).toLowerCase()
671 }
672
673 function g(c, g, l, n, o, p) {
674 function q(a, c) {
675 if ("string" == typeof a && (a = h.querySelector(a)), !a ||
676 !m(a)) return void(i && i.error("Bad " +
677 this.constructor.namespace + " element: " + a));
678 this.element = a, this.options = b({},
679 this.constructor.defaults), this.option(c);
680 var d = ++r;
681 this.element.outlayerGUID = d, s[d] = this, this._create(),
682 this.options.isInitLayout && this.layout()
683 }
684 var r = 0,
685 s = {};
686 return q.namespace = "outlayer", q.Item = p, q.defaults = {
687 containerStyle: {
688 position: "relative"
689 },
690 isInitLayout: !0,
691 isOriginLeft: !0,
692 isOriginTop: !0,
693 isResizeBound: !0,
694 isResizingContainer: !0,
695 transitionDuration: "0.4s",
696 hiddenStyle: {
697 opacity: 0,
698 transform: "scale(0.001)"
699 },
700 visibleStyle: {
701 opacity: 1,
702 transform: "scale(1)"
703 }
704 }, b(q.prototype, l.prototype), q.prototype.option = function(a) {
705 b(this.options, a)
706 }, q.prototype._create = function() {
707 this.reloadItems(), this.stamps = [],
708 this.stamp(this.options.stamp), b(this.element.style,
709 this.options.containerStyle), this.options.isResizeBound &&
710 this.bindResize()
711 }, q.prototype.reloadItems = function() {
712 this.items = this._itemize(this.element.children)
713 }, q.prototype._itemize = function(a) {
714 for (var b = this._filterFindItemElements(a), c =
715 this.constructor.Item, d = [], e = 0, f = b.length; f > e;
716 e++) {
717 var g = b[e],
718 h = new c(g, this);
719 d.push(h)
720 }
721 return d
722 }, q.prototype._filterFindItemElements = function(a) {
723 a = d(a);
724 for (var b = this.options.itemSelector, c = [], e = 0, f =
725 a.length; f > e; e++) {
726 var g = a[e];
727 if (m(g))
728 if (b) {
729 o(g, b) && c.push(g);
730 for (var h = g.querySelectorAll(b), i = 0, j =
731 h.length; j > i; i++) c.push(h[i])
732 } else c.push(g)
733 }
734 return c
735 }, q.prototype.getItemElements = function() {
736 for (var a = [], b = 0, c = this.items.length; c > b; b++)
737 a.push(this.items[b].element);
738 return a
739 }, q.prototype.layout = function() {
740 this._resetLayout(), this._manageStamps();
741 var a = void 0 !== this.options.isLayoutInstant ?
742 this.options.isLayoutInstant : !this._isLayoutInited;
743 this.layoutItems(this.items, a), this._isLayoutInited = !0
744 }, q.prototype._init = q.prototype.layout, q.prototype._resetLayout
745 = function() {
746 this.getSize()
747 }, q.prototype.getSize = function() {
748 this.size = n(this.element)
749 }, q.prototype._getMeasurement = function(a, b) {
750 var c, d = this.options[a];
751 d ? ("string" == typeof d ? c = this.element.querySelector(d) :
752 m(d) && (c = d), this[a] = c ? n(c)[b] : d) : this[a] = 0
753 }, q.prototype.layoutItems = function(a, b) {
754 a = this._getItemsForLayout(a), this._layoutItems(a, b),
755 this._postLayout()
756 }, q.prototype._getItemsForLayout = function(a) {
757 for (var b = [], c = 0, d = a.length; d > c; c++) {
758 var e = a[c];
759 e.isIgnored || b.push(e)
760 }
761 return b
762 }, q.prototype._layoutItems = function(a, b) {
763 function c() {
764 d.emitEvent("layoutComplete", [d, a])
765 }
766 var d = this;
767 if (!a || !a.length) return void c();
768 this._itemsOn(a, "layout", c);
769 for (var e = [], f = 0, g = a.length; g > f; f++) {
770 var h = a[f],
771 i = this._getItemLayoutPosition(h);
772 i.item = h, i.isInstant = b || h.isLayoutInstant, e.push(i)
773 }
774 this._processLayoutQueue(e)
775 }, q.prototype._getItemLayoutPosition = function() {
776 return {
777 x: 0,
778 y: 0
779 }
780 }, q.prototype._processLayoutQueue = function(a) {
781 for (var b = 0, c = a.length; c > b; b++) {
782 var d = a[b];
783 this._positionItem(d.item, d.x, d.y, d.isInstant)
784 }
785 }, q.prototype._positionItem = function(a, b, c, d) {
786 d ? a.goTo(b, c) : a.moveTo(b, c)
787 }, q.prototype._postLayout = function() {
788 this.resizeContainer()
789 }, q.prototype.resizeContainer = function() {
790 if (this.options.isResizingContainer) {
791 var a = this._getContainerSize();
792 a && (this._setContainerMeasure(a.width, !0),
793 this._setContainerMeasure(a.height, !1))
794 }
795 }, q.prototype._getContainerSize = k,
796 q.prototype._setContainerMeasure = function(a, b) {
797 if (void 0 !== a) {
798 var c = this.size;
799 c.isBorderBox && (a += b ? c.paddingLeft + c.paddingRight +
800 c.borderLeftWidth + c.borderRightWidth : c.paddingBottom
801 + c.paddingTop + c.borderTopWidth +
802 c.borderBottomWidth), a = Math.max(a, 0),
803 this.element.style[b ? "width" : "height"] = a + "px"
804 }
805 }, q.prototype._itemsOn = function(a, b, c) {
806 function d() {
807 return e++, e === f && c.call(g), !0
808 }
809 for (var e = 0, f = a.length, g = this, h = 0, i = a.length; i >
810 h; h++) {
811 var j = a[h];
812 j.on(b, d)
813 }
814 }, q.prototype.ignore = function(a) {
815 var b = this.getItem(a);
816 b && (b.isIgnored = !0)
817 }, q.prototype.unignore = function(a) {
818 var b = this.getItem(a);
819 b && delete b.isIgnored
820 }, q.prototype.stamp = function(a) {
821 if (a = this._find(a)) {
822 this.stamps = this.stamps.concat(a);
823 for (var b = 0, c = a.length; c > b; b++) {
824 var d = a[b];
825 this.ignore(d)
826 }
827 }
828 }, q.prototype.unstamp = function(a) {
829 if (a = this._find(a))
830 for (var b = 0, c = a.length; c > b; b++) {
831 var d = a[b];
832 e(d, this.stamps), this.unignore(d)
833 }
834 }, q.prototype._find = function(a) {
835 return a ? ("string" == typeof a && (a =
836 this.element.querySelectorAll(a)), a = d(a)) : void 0
837 }, q.prototype._manageStamps = function() {
838 if (this.stamps && this.stamps.length) {
839 this._getBoundingRect();
840 for (var a = 0, b = this.stamps.length; b > a; a++) {
841 var c = this.stamps[a];
842 this._manageStamp(c)
843 }
844 }
845 }, q.prototype._getBoundingRect = function() {
846 var a = this.element.getBoundingClientRect(),
847 b = this.size;
848 this._boundingRect = {
849 left: a.left + b.paddingLeft + b.borderLeftWidth,
850 top: a.top + b.paddingTop + b.borderTopWidth,
851 right: a.right - (b.paddingRight + b.borderRightWidth),
852 bottom: a.bottom - (b.paddingBottom + b.borderBottomWidth)
853 }
854 }, q.prototype._manageStamp = k, q.prototype._getElementOffset =
855 function(a) {
856 var b = a.getBoundingClientRect(),
857 c = this._boundingRect,
858 d = n(a),
859 e = {
860 left: b.left - c.left - d.marginLeft,
861 top: b.top - c.top - d.marginTop,
862 right: c.right - b.right - d.marginRight,
863 bottom: c.bottom - b.bottom - d.marginBottom
864 };
865 return e
866 }, q.prototype.handleEvent = function(a) {
867 var b = "on" + a.type;
868 this[b] && this[b](a)
869 }, q.prototype.bindResize = function() {
870 this.isResizeBound || (c.bind(a, "resize", this),
871 this.isResizeBound = !0)
872 }, q.prototype.unbindResize = function() {
873 this.isResizeBound && c.unbind(a, "resize", this),
874 this.isResizeBound = !1
875 }, q.prototype.onresize = function() {
876 function a() {
877 b.resize(), delete b.resizeTimeout
878 }
879 this.resizeTimeout && clearTimeout(this.resizeTimeout);
880 var b = this;
881 this.resizeTimeout = setTimeout(a, 100)
882 }, q.prototype.resize = function() {
883 this.isResizeBound && this.needsResizeLayout() && this.layout()
884 }, q.prototype.needsResizeLayout = function() {
885 var a = n(this.element),
886 b = this.size && a;
887 return b && a.innerWidth !== this.size.innerWidth
888 }, q.prototype.addItems = function(a) {
889 var b = this._itemize(a);
890 return b.length && (this.items = this.items.concat(b)), b
891 }, q.prototype.appended = function(a) {
892 var b = this.addItems(a);
893 b.length && (this.layoutItems(b, !0), this.reveal(b))
894 }, q.prototype.prepended = function(a) {
895 var b = this._itemize(a);
896 if (b.length) {
897 var c = this.items.slice(0);
898 this.items = b.concat(c), this._resetLayout(),
899 this._manageStamps(), this.layoutItems(b, !0),
900 this.reveal(b), this.layoutItems(c)
901 }
902 }, q.prototype.reveal = function(a) {
903 var b = a && a.length;
904 if (b)
905 for (var c = 0; b > c; c++) {
906 var d = a[c];
907 d.reveal()
908 }
909 }, q.prototype.hide = function(a) {
910 var b = a && a.length;
911 if (b)
912 for (var c = 0; b > c; c++) {
913 var d = a[c];
914 d.hide()
915 }
916 }, q.prototype.getItem = function(a) {
917 for (var b = 0, c = this.items.length; c > b; b++) {
918 var d = this.items[b];
919 if (d.element === a) return d
920 }
921 }, q.prototype.getItems = function(a) {
922 if (a && a.length) {
923 for (var b = [], c = 0, d = a.length; d > c; c++) {
924 var e = a[c],
925 f = this.getItem(e);
926 f && b.push(f)
927 }
928 return b
929 }
930 }, q.prototype.remove = function(a) {
931 a = d(a);
932 var b = this.getItems(a);
933 if (b && b.length) {
934 this._itemsOn(b, "remove", function() {
935 this.emitEvent("removeComplete", [this, b])
936 });
937 for (var c = 0, f = b.length; f > c; c++) {
938 var g = b[c];
939 g.remove(), e(g, this.items)
940 }
941 }
942 }, q.prototype.destroy = function() {
943 var a = this.element.style;
944 a.height = "", a.position = "", a.width = "";
945 for (var b = 0, c = this.items.length; c > b; b++) {
946 var d = this.items[b];
947 d.destroy()
948 }
949 this.unbindResize();
950 var e = this.element.outlayerGUID;
951 delete s[e], delete this.element.outlayerGUID, j &&
952 j.removeData(this.element, this.constructor.namespace)
953 }, q.data = function(a) {
954 var b = a && a.outlayerGUID;
955 return b && s[b]
956 }, q.create = function(a, c) {
957 function d() {
958 q.apply(this, arguments)
959 }
960 return Object.create ? d.prototype = Object.create(q.prototype)
961 : b(d.prototype, q.prototype), d.prototype.constructor = d,
962 d.defaults = b({}, q.defaults), b(d.defaults, c),
963 d.prototype.settings = {}, d.namespace = a, d.data = q.data,
964 d.Item = function() {
965 p.apply(this, arguments)
966 }, d.Item.prototype = new p, g(function() {
967 for (var b = f(a), c = h.querySelectorAll(".js-" + b), e =
968 "data-" + b + "-options", g = 0, k = c.length; k > g;
969 g++) {
970 var l, m = c[g],
971 n = m.getAttribute(e);
972 try {
973 l = n && JSON.parse(n)
974 } catch (o) {
975 i && i.error("Error parsing " + e + " on " +
976 m.nodeName.toLowerCase() + (m.id ? "#" + m.id :
977 "") + ": " + o);
978 continue
979 }
980 var p = new d(m, l);
981 j && j.data(m, a, p)
982 }
983 }), j && j.bridget && j.bridget(a, d), d
984 }, q.Item = p, q
985 }
986 var h = a.document,
987 i = a.console,
988 j = a.jQuery,
989 k = function() {},
990 l = Object.prototype.toString,
991 m = "function" == typeof HTMLElement || "object" == typeof
992 HTMLElement ? function(a) {
993 return a instanceof HTMLElement
994 } : function(a) {
995 return a && "object" == typeof a && 1 === a.nodeType && "string"
996 == typeof a.nodeName
997 },
998 n = Array.prototype.indexOf ? function(a, b) {
999 return a.indexOf(b)
1000 } : function(a, b) {
1001 for (var c = 0, d = a.length; d > c; c++)
1002 if (a[c] === b) return c;
1003 return -1
1004 };
1005 "function" == typeof define && define.amd ? define("outlayer/outlayer",
1006 ["eventie/eventie", "doc-ready/doc-ready",
1007 "eventEmitter/EventEmitter", "get-size/get-size",
1008 "matches-selector/matches-selector", "./item"], g) : "object" ==
1009 typeof exports ? module.exports = g(require("eventie"),
1010 require("doc-ready"), require("wolfy87-eventemitter"),
1011 require("get-size"), require("desandro-matches-selector"),
1012 require("./item")) : a.Outlayer = g(a.eventie, a.docReady,
1013 a.EventEmitter, a.getSize, a.matchesSelector, a.Outlayer.Item)
1014 }(window),
1015 function(a) {
1016 function b(a, b) {
1017 var d = a.create("masonry");
1018 return d.prototype._resetLayout = function() {
1019 this.getSize(), this._getMeasurement("columnWidth",
1020 "outerWidth"), this._getMeasurement("gutter", "outerWidth"),
1021 this.measureColumns();
1022 var a = this.cols;
1023 for (this.colYs = []; a--;) this.colYs.push(0);
1024 this.maxY = 0
1025 }, d.prototype.measureColumns = function() {
1026 if (this.getContainerWidth(), !this.columnWidth) {
1027 var a = this.items[0],
1028 c = a && a.element;
1029 this.columnWidth = c && b(c).outerWidth ||
1030 this.containerWidth
1031 }
1032 this.columnWidth += this.gutter, this.cols =
1033 Math.floor((this.containerWidth + this.gutter) /
1034 this.columnWidth), this.cols = Math.max(this.cols, 1)
1035 }, d.prototype.getContainerWidth = function() {
1036 var a = this.options.isFitWidth ? this.element.parentNode :
1037 this.element,
1038 c = b(a);
1039 this.containerWidth = c && c.innerWidth
1040 }, d.prototype._getItemLayoutPosition = function(a) {
1041 a.getSize();
1042 var b = a.size.outerWidth % this.columnWidth,
1043 d = b && 1 > b ? "round" : "ceil",
1044 e = Math[d](a.size.outerWidth / this.columnWidth);
1045 e = Math.min(e, this.cols);
1046 for (var f = this._getColGroup(e), g = Math.min.apply(Math, f),
1047 h = c(f, g), i = {
1048 x: this.columnWidth * h,
1049 y: g
1050 }, j = g + a.size.outerHeight, k = this.cols + 1 - f.length,
1051 l = 0; k > l; l++) this.colYs[h + l] = j;
1052 return i
1053 }, d.prototype._getColGroup = function(a) {
1054 if (2 > a) return this.colYs;
1055 for (var b = [], c = this.cols + 1 - a, d = 0; c > d; d++) {
1056 var e = this.colYs.slice(d, d + a);
1057 b[d] = Math.max.apply(Math, e)
1058 }
1059 return b
1060 }, d.prototype._manageStamp = function(a) {
1061 var c = b(a),
1062 d = this._getElementOffset(a),
1063 e = this.options.isOriginLeft ? d.left : d.right,
1064 f = e + c.outerWidth,
1065 g = Math.floor(e / this.columnWidth);
1066 g = Math.max(0, g);
1067 var h = Math.floor(f / this.columnWidth);
1068 h -= f % this.columnWidth ? 0 : 1, h = Math.min(this.cols - 1,
1069 h);
1070 for (var i = (this.options.isOriginTop ? d.top : d.bottom) +
1071 c.outerHeight, j = g; h >= j; j++) this.colYs[j] =
1072 Math.max(i, this.colYs[j])
1073 }, d.prototype._getContainerSize = function() {
1074 this.maxY = Math.max.apply(Math, this.colYs);
1075 var a = {
1076 height: this.maxY
1077 };
1078 return this.options.isFitWidth && (a.width =
1079 this._getContainerFitWidth()), a
1080 }, d.prototype._getContainerFitWidth = function() {
1081 for (var a = 0, b = this.cols; --b && 0 === this.colYs[b];) a++;
1082 return (this.cols - a) * this.columnWidth - this.gutter
1083 }, d.prototype.needsResizeLayout = function() {
1084 var a = this.containerWidth;
1085 return this.getContainerWidth(), a !== this.containerWidth
1086 }, d
1087 }
1088 var c = Array.prototype.indexOf ? function(a, b) {
1089 return a.indexOf(b)
1090 } : function(a, b) {
1091 for (var c = 0, d = a.length; d > c; c++) {
1092 var e = a[c];
1093 if (e === b) return c
1094 }
1095 return -1
1096 };
1097 "function" == typeof define && define.amd ? define(["outlayer/outlayer",
1098 "get-size/get-size"], b) : "object" == typeof exports ?
1099 module.exports = b(require("outlayer"), require("get-size")) :
1100 a.Masonry = b(a.Outlayer, a.getSize)
1101 }(window);
OLDNEW
« no previous file with comments | « tools/perf/page_sets/key_silk_cases/masonry.html ('k') | tools/run-perf-test.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698