/* modernizr 2.6.2 (custom build) | mit & bsd
* build: http://modernizr.com/download/#-cssanimations-shiv-cssclasses-testprop-testallprops-domprefixes-load
*/
;
window.modernizr = function (a, b, c) {
function x(a) {
j.csstext = a
}
function y(a, b) {
return x(prefixes.join(a + ";") + (b || ""))
}
function z(a, b) {
return typeof a === b
}
function a(a, b) {
return !!~("" + a).indexof(b)
}
function b(a, b) {
for (var d in a) {
var e = a[d];
if (!a(e, "-") && j[e] !== c) return b == "pfx" ? e : !0
}
return !1
}
function c(a, b, d) {
for (var e in a) {
var f = b[a[e]];
if (f !== c) return d === !1 ? a[e] : z(f, "function") ? f.bind(d || b) : f
}
return !1
}
function d(a, b, c) {
var d = a.charat(0).touppercase() + a.slice(1),
e = (a + " " + n.join(d + " ") + d).split(" ");
return z(b, "string") || z(b, "undefined") ? b(e, b) : (e = (a + " " + o.join(d + " ") + d).split(" "), c(e, b, c))
}
var d = "2.6.2",
e = {},
f = !0,
g = b.documentelement,
h = "modernizr",
i = b.createelement(h),
j = i.style,
k, l = {}.tostring,
m = "webkit moz o ms",
n = m.split(" "),
o = m.tolowercase().split(" "),
p = {},
q = {},
r = {},
s = [],
t = s.slice,
u, v = {}.hasownproperty,
w;
!z(v, "undefined") && !z(v.call, "undefined") ? w = function (a, b) {
return v.call(a, b)
} : w = function (a, b) {
return b in a && z(a.constructor.prototype[b], "undefined")
}, function.prototype.bind || (function.prototype.bind = function (b) {
var c = this;
if (typeof c != "function") throw new typeerror;
var d = t.call(arguments, 1),
e = function () {
if (this instanceof e) {
var a = function () {};
a.prototype = c.prototype;
var f = new a,
g = c.apply(f, d.concat(t.call(arguments)));
return object(g) === g ? g : f
}
return c.apply(b, d.concat(t.call(arguments)))
};
return e
}), p.cssanimations = function () {
return d("animationname")
};
for (var e in p) w(p, e) && (u = e.tolowercase(), e[u] = p[e](), s.push((e[u] ? "" : "no-") + u));
return e.addtest = function (a, b) {
if (typeof a == "object")
for (var d in a) w(a, d) && e.addtest(d, a[d]);
else {
a = a.tolowercase();
if (e[a] !== c) return e;
b = typeof b == "function" ? b() : b, typeof f != "undefined" && f && (g.classname += " " + (b ? "" : "no-") + a), e[a] = b
}
return e
}, x(""), i = k = null,
function (a, b) {
function k(a, b) {
var c = a.createelement("p"),
d = a.getelementsbytagname("head")[0] || a.documentelement;
return c.innerhtml = "x", d.insertbefore(c.lastchild, d.firstchild)
}
function l() {
var a = r.elements;
return typeof a == "string" ? a.split(" ") : a
}
function m(a) {
var b = i[a[g]];
return b || (b = {}, h++, a[g] = h, i[h] = b), b
}
function n(a, c, f) {
c || (c = b);
if (j) return c.createelement(a);
f || (f = m(c));
var g;
return f.cache[a] ? g = f.cache[a].clonenode() : e.test(a) ? g = (f.cache[a] = f.createelem(a)).clonenode() : g = f.createelem(a), g.canhavechildren && !d.test(a) ? f.frag.appendchild(g) : g
}
function o(a, c) {
a || (a = b);
if (j) return a.createdocumentfragment();
c = c || m(a);
var d = c.frag.clonenode(),
e = 0,
f = l(),
g = f.length;
for (; e < g; e++) d.createelement(f[e]);
return d
}
function p(a, b) {
b.cache || (b.cache = {}, b.createelem = a.createelement, b.createfrag = a.createdocumentfragment, b.frag = b.createfrag()), a.createelement = function (c) {
return r.shivmethods ? n(c, a, b) : b.createelem(c)
}, a.createdocumentfragment = function("h,f", "return function(){var n=f.clonenode(),c=n.createelement;h.shivmethods&&(" + l().join().replace(/\w+/g, function (a) {
return b.createelem(a), b.frag.createelement(a), 'c("' + a + '")'
}) + ");return n}")(r, b.frag)
}
function q(a) {
a || (a = b);
var c = m(a);
return r.shivcss && !f && !c.hascss && (c.hascss = !!k(a, "article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#ff0;color:#000}")), j || p(a, c), a
}
var c = a.html5 || {},
d = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,
e = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,
f, g = "_html5shiv",
h = 0,
i = {},
j;
(function () {
try {
var a = b.createelement("a");
a.innerhtml = "", f = "hidden" in a, j = a.childnodes.length == 1 || function () {
b.createelement("a");
var a = b.createdocumentfragment();
return typeof a.clonenode == "undefined" || typeof a.createdocumentfragment == "undefined" || typeof a.createelement == "undefined"
}()
} catch (c) {
f = !0, j = !0
}
})();
var r = {
elements: c.elements || "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",
shivcss: c.shivcss !== !1,
supportsunknownelements: j,
shivmethods: c.shivmethods !== !1,
type: "default",
shivdocument: q,
createelement: n,
createdocumentfragment: o
};
a.html5 = r, q(b)
}(this, b), e._version = d, e._domprefixes = o, e._cssomprefixes = n, e.testprop = function (a) {
return b([a])
}, e.testallprops = d, g.classname = g.classname.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (f ? " js " + s.join(" ") : ""), e
}(this, this.document),
function (a, b, c) {
function d(a) {
return "[object function]" == o.call(a)
}
function e(a) {
return "string" == typeof a
}
function f() {}
function g(a) {
return !a || "loaded" == a || "complete" == a || "uninitialized" == a
}
function h() {
var a = p.shift();
q = 1, a ? a.t ? m(function () {
("c" == a.t ? b.injectcss : b.injectjs)(a.s, 0, a.a, a.x, a.e, 1)
}, 0) : (a(), h()) : q = 0
}
function i(a, c, d, e, f, i, j) {
function k(b) {
if (!o && g(l.readystate) && (u.r = o = 1, !q && h(), l.onload = l.onreadystatechange = null, b)) {
"img" != a && m(function () {
t.removechild(l)
}, 50);
for (var d in y[c]) y[c].hasownproperty(d) && y[c][d].onload()
}
}
var j = j || b.errortimeout,
l = b.createelement(a),
o = 0,
r = 0,
u = {
t: d,
s: c,
e: f,
a: i,
x: j
};
1 === y[c] && (r = 1, y[c] = []), "object" == a ? l.data = c : (l.src = c, l.type = a), l.width = l.height = "0", l.onerror = l.onload = l.onreadystatechange = function () {
k.call(this, r)
}, p.splice(e, 0, u), "img" != a && (r || 2 === y[c] ? (t.insertbefore(l, s ? null : n), m(k, j)) : y[c].push(l))
}
function j(a, b, c, d, f) {
return q = 0, b = b || "j", e(a) ? i("c" == b ? v : u, a, b, this.i++, c, d, f) : (p.splice(this.i++, 0, a), 1 == p.length && h()), this
}
function k() {
var a = b;
return a.loader = {
load: j,
i: 0
}, a
}
var l = b.documentelement,
m = a.settimeout,
n = b.getelementsbytagname("script")[0],
o = {}.tostring,
p = [],
q = 0,
r = "mozappearance" in l.style,
s = r && !!b.createrange().comparenode,
t = s ? l : n.parentnode,
l = a.opera && "[object opera]" == o.call(a.opera),
l = !!b.attachevent && !l,
u = r ? "object" : l ? "script" : "img",
v = l ? "script" : u,
w = array.isarray || function (a) {
return "[object array]" == o.call(a)
},
x = [],
y = {},
z = {
timeout: function (a, b) {
return b.length && (a.timeout = b[0]), a
}
},
a, b;
b = function (a) {
function b(a) {
var a = a.split("!"),
b = x.length,
c = a.pop(),
d = a.length,
c = {
url: c,
origurl: c,
prefixes: a
},
e, f, g;
for (f = 0; f < d; f++) g = a[f].split("="), (e = z[g.shift()]) && (c = e(c, g));
for (f = 0; f < b; f++) c = x[f](c);
return c
}
function g(a, e, f, g, h) {
var i = b(a),
j = i.autocallback;
i.url.split(".").pop().split("?").shift(), i.bypass || (e && (e = d(e) ? e : e[a] || e[g] || e[a.split("/").pop().split("?")[0]]), i.instead ? i.instead(a, e, f, g, h) : (y[i.url] ? i.noexec = !0 : y[i.url] = 1, f.load(i.url, i.forcecss || !i.forcejs && "css" == i.url.split(".").pop().split("?").shift() ? "c" : c, i.noexec, i.attrs, i.timeout), (d(e) || d(j)) && f.load(function () {
k(), e && e(i.origurl, h, g), j && j(i.origurl, h, g), y[i.url] = 2
})))
}
function h(a, b) {
function c(a, c) {
if (a) {
if (e(a)) c || (j = function () {
var a = [].slice.call(arguments);
k.apply(this, a), l()
}), g(a, j, b, 0, h);
else if (object(a) === a)
for (n in m = function () {
var b = 0,
c;
for (c in a) a.hasownproperty(c) && b++;
return b
}(), a) a.hasownproperty(n) && (!c && !--m && (d(j) ? j = function () {
var a = [].slice.call(arguments);
k.apply(this, a), l()
} : j[n] = function (a) {
return function () {
var b = [].slice.call(arguments);
a && a.apply(this, b), l()
}
}(k[n])), g(a[n], j, b, n, h))
} else !c && l()
}
var h = !!a.test,
i = a.load || a.both,
j = a.callback || f,
k = j,
l = a.complete || f,
m, n;
c(h ? a.yep : a.nope, !!i), i && c(i)
}
var i, j, l = this.yepnope.loader;
if (e(a)) g(a, 0, l, 0);
else if (w(a))
for (i = 0; i < a.length; i++) j = a[i], e(j) ? g(j, 0, l, 0) : w(j) ? b(j) : object(j) === j && h(j, l);
else object(a) === a && h(a, l)
}, b.addprefix = function (a, b) {
z[a] = b
}, b.addfilter = function (a) {
x.push(a)
}, b.errortimeout = 1e4, null == b.readystate && b.addeventlistener && (b.readystate = "loading", b.addeventlistener("domcontentloaded", a = function () {
b.removeeventlistener("domcontentloaded", a, 0), b.readystate = "complete"
}, 0)), a.yepnope = k(), a.yepnope.executestack = h, a.yepnope.injectjs = function (a, c, d, e, i, j) {
var k = b.createelement("script"),
l, o, e = e || b.errortimeout;
k.src = a;
for (o in d) k.setattribute(o, d[o]);
c = j ? h : c || f, k.onreadystatechange = k.onload = function () {
!l && g(k.readystate) && (l = 1, c(), k.onload = k.onreadystatechange = null)
}, m(function () {
l || (l = 1, c(1))
}, e), i ? k.onload() : n.parentnode.insertbefore(k, n)
}, a.yepnope.injectcss = function (a, c, d, e, g, i) {
var e = b.createelement("link"),
j, c = i ? h : c || f;
e.href = a, e.rel = "stylesheet", e.type = "text/css";
for (j in d) e.setattribute(j, d[j]);
g || (n.parentnode.insertbefore(e, n), m(c, 0))
}
}(this, document), modernizr.load = function () {
yepnope.apply(window, [].slice.call(arguments, 0))
};
/*!
* masonry packaged v3.0.0
* cascading grid layout library
* http://masonry.desandro.com
* mit license
* by david desandro
*/
(function (t) {
"use strict";
function e(t) {
if (t) {
if ("string" == typeof n[t]) return t;
t = t.charat(0).touppercase() + t.slice(1);
for (var e, o = 0, r = i.length; r > o; o++)
if (e = i[o] + t, "string" == typeof n[e]) return e
}
}
var i = "webkit moz ms ms o".split(" "),
n = document.documentelement.style;
"function" == typeof define && define.amd ? define(function () {
return e
}) : t.getstyleproperty = e
})(window),
function (t) {
"use strict";
function e(t) {
var e = parsefloat(t),
i = -1 === t.indexof("%") && !isnan(e);
return i && e
}
function i() {
for (var t = {
width: 0,
height: 0,
innerwidth: 0,
innerheight: 0,
outerwidth: 0,
outerheight: 0
}, e = 0, i = s.length; i > e; e++) {
var n = s[e];
t[n] = 0
}
return t
}
function n(t) {
function n(t) {
if ("string" == typeof t && (t = document.queryselector(t)), t && "object" == typeof t && t.nodetype) {
var n = r(t);
if ("none" === n.display) return i();
var h = {};
h.width = t.offsetwidth, h.height = t.offsetheight;
for (var p = h.isborderbox = !(!a || !n[a] || "border-box" !== n[a]), u = 0, f = s.length; f > u; u++) {
var d = s[u],
c = n[d],
l = parsefloat(c);
h[d] = isnan(l) ? 0 : l
}
var m = h.paddingleft + h.paddingright,
y = h.paddingtop + h.paddingbottom,
g = h.marginleft + h.marginright,
v = h.margintop + h.marginbottom,
_ = h.borderleftwidth + h.borderrightwidth,
b = h.bordertopwidth + h.borderbottomwidth,
l = p && o,
e = e(n.width);
e !== !1 && (h.width = e + (l ? 0 : m + _));
var i = e(n.height);
return i !== !1 && (h.height = i + (l ? 0 : y + b)), h.innerwidth = h.width - (m + _), h.innerheight = h.height - (y + b), h.outerwidth = h.width + g, h.outerheight = h.height + v, h
}
}
var o, a = t("boxsizing");
return function () {
if (a) {
var t = document.createelement("div");
t.style.width = "200px", t.style.padding = "1px 2px 3px 4px", t.style.borderstyle = "solid", t.style.borderwidth = "1px 2px 3px 4px", t.style[a] = "border-box";
var i = document.body || document.documentelement;
i.appendchild(t);
var n = r(t);
o = 200 === e(n.width), i.removechild(t)
}
}(), n
}
var o = document.defaultview,
r = o && o.getcomputedstyle ? function (t) {
return o.getcomputedstyle(t, null)
} : function (t) {
return t.currentstyle
},
s = ["paddingleft", "paddingright", "paddingtop", "paddingbottom", "marginleft", "marginright", "margintop", "marginbottom", "borderleftwidth", "borderrightwidth", "bordertopwidth", "borderbottomwidth"];
"function" == typeof define && define.amd ? define(["get-style-property"], n) : t.getsize = n(t.getstyleproperty)
}(window),
function (t) {
"use strict";
var e = document.documentelement,
i = function () {};
e.addeventlistener ? i = function (t, e, i) {
t.addeventlistener(e, i, !1)
} : e.attachevent && (i = function (e, i, n) {
e[i + n] = n.handleevent ? function () {
var e = t.event;
e.target = e.target || e.srcelement, n.handleevent.call(n, e)
} : function () {
var i = t.event;
i.target = i.target || i.srcelement, n.call(e, i)
}, e.attachevent("on" + i, e[i + n])
});
var n = function () {};
e.removeeventlistener ? n = function (t, e, i) {
t.removeeventlistener(e, i, !1)
} : e.detachevent && (n = function (t, e, i) {
t.detachevent("on" + e, t[e + i]);
try {
delete t[e + i]
} catch (n) {
t[e + i] = void 0
}
});
var o = {
bind: i,
unbind: n
};
"function" == typeof define && define.amd ? define(o) : t.eventie = o
}(this),
function (t) {
"use strict";
function e(t) {
"function" == typeof t && (e.isready ? t() : r.push(t))
}
function i(t) {
var i = "readystatechange" === t.type && "complete" !== o.readystate;
if (!e.isready && !i) {
e.isready = !0;
for (var n = 0, s = r.length; s > n; n++) {
var a = r[n];
a()
}
}
}
function n(n) {
return n.bind(o, "domcontentloaded", i), n.bind(o, "readystatechange", i), n.bind(t, "load", i), e
}
var o = t.document,
r = [];
e.isready = !1, "function" == typeof define && define.amd ? define(["eventie"], n) : t.docready = n(t.eventie)
}(this),
function (t) {
"use strict";
function e() {}
function i(t, e) {
if (o) return e.indexof(t);
for (var i = e.length; i--;)
if (e[i] === t) return i;
return -1
}
var n = e.prototype,
o = array.prototype.indexof ? !0 : !1;
n._getevents = function () {
return this._events || (this._events = {})
}, n.getlisteners = function (t) {
var e, i, n = this._getevents();
if ("object" == typeof t) {
e = {};
for (i in n) n.hasownproperty(i) && t.test(i) && (e[i] = n[i])
} else e = n[t] || (n[t] = []);
return e
}, n.getlistenersasobject = function (t) {
var e, i = this.getlisteners(t);
return i instanceof array && (e = {}, e[t] = i), e || i
}, n.addlistener = function (t, e) {
var n, o = this.getlistenersasobject(t);
for (n in o) o.hasownproperty(n) && -1 === i(e, o[n]) && o[n].push(e);
return this
}, n.on = n.addlistener, n.defineevent = function (t) {
return this.getlisteners(t), this
}, n.defineevents = function (t) {
for (var e = 0; t.length > e; e += 1) this.defineevent(t[e]);
return this
}, n.removelistener = function (t, e) {
var n, o, r = this.getlistenersasobject(t);
for (o in r) r.hasownproperty(o) && (n = i(e, r[o]), -1 !== n && r[o].splice(n, 1));
return this
}, n.off = n.removelistener, n.addlisteners = function (t, e) {
return this.manipulatelisteners(!1, t, e)
}, n.removelisteners = function (t, e) {
return this.manipulatelisteners(!0, t, e)
}, n.manipulatelisteners = function (t, e, i) {
var n, o, r = t ? this.removelistener : this.addlistener,
s = t ? this.removelisteners : this.addlisteners;
if ("object" != typeof e || e instanceof regexp)
for (n = i.length; n--;) r.call(this, e, i[n]);
else
for (n in e) e.hasownproperty(n) && (o = e[n]) && ("function" == typeof o ? r.call(this, n, o) : s.call(this, n, o));
return this
}, n.removeevent = function (t) {
var e, i = typeof t,
n = this._getevents();
if ("string" === i) delete n[t];
else if ("object" === i)
for (e in n) n.hasownproperty(e) && t.test(e) && delete n[e];
else delete this._events;
return this
}, n.emitevent = function (t, e) {
var i, n, o, r = this.getlistenersasobject(t);
for (n in r)
if (r.hasownproperty(n))
for (i = r[n].length; i--;) o = e ? r[n][i].apply(null, e) : r[n][i](), o === !0 && this.removelistener(t, r[n][i]);
return this
}, n.trigger = n.emitevent, n.emit = function (t) {
var e = array.prototype.slice.call(arguments, 1);
return this.emitevent(t, e)
}, "function" == typeof define && define.amd ? define(function () {
return e
}) : t.eventemitter = e
}(this),
function (t) {
"use strict";
function e() {}
function i(t) {
function i(e) {
e.prototype.option || (e.prototype.option = function (e) {
t.isplainobject(e) && (this.options = t.extend(!0, this.options, e))
})
}
function o(e, i) {
t.fn[e] = function (o) {
if ("string" == typeof o) {
for (var s = n.call(arguments, 1), a = 0, h = this.length; h > a; a++) {
var p = this[a],
u = t.data(p, e);
if (u)
if (t.isfunction(u[o]) && "_" !== o.charat(0)) {
var f = u[o].apply(u, s);
if (void 0 !== f) return f
} else r("no such method '" + o + "' for " + e + " instance");
else r("cannot call methods on " + e + " prior to initialization; " + "attempted to call '" + o + "'")
}
return this
}
return this.each(function () {
var n = t.data(this, e);
n ? (n.option(o), n._init()) : (n = new i(this, o), t.data(this, e, n))
})
}
}
if (t) {
var r = "undefined" == typeof console ? e : function (t) {
console.error(t)
};
t.bridget = function (t, e) {
i(e), o(t, e)
}
}
}
var n = array.prototype.slice;
"function" == typeof define && define.amd ? define(["jquery"], i) : i(t.jquery)
}(window),
function (t, e) {
"use strict";
function i(t, e) {
return t[a](e)
}
function n(t) {
if (!t.parentnode) {
var e = document.createdocumentfragment();
e.appendchild(t)
}
}
function o(t, e) {
n(t);
for (var i = t.parentnode.queryselectorall(e), o = 0, r = i.length; r > o; o++)
if (i[o] === t) return !0;
return !1
}
function r(t, e) {
return n(t), i(t, e)
}
var s, a = function () {
if (e.matchesselector) return "matchesselector";
for (var t = ["webkit", "moz", "ms", "o"], i = 0, n = t.length; n > i; i++) {
var o = t[i],
r = o + "matchesselector";
if (e[r]) return r
}
}();
if (a) {
var h = document.createelement("div"),
p = i(h, "div");
s = p ? i : r
} else s = o;
"function" == typeof define && define.amd ? define(function () {
return s
}) : window.matchesselector = s
}(this, element.prototype),
function (t) {
"use strict";
function e(t, e) {
for (var i in e) t[i] = e[i];
return t
}
function i(t, e) {
t && (this.element = t, this.layout = e, this.position = {
x: 0,
y: 0
}, this._create())
}
var n = t.getsize,
o = t.getstyleproperty,
r = t.eventemitter,
s = document.defaultview,
a = s && s.getcomputedstyle ? function (t) {
return s.getcomputedstyle(t, null)
} : function (t) {
return t.currentstyle
},
h = o("transition"),
p = o("transform"),
u = h && p,
f = !!o("perspective"),
d = {
webkittransition: "webkittransitionend",
moztransition: "transitionend",
otransition: "otransitionend",
transition: "transitionend"
}[h],
c = ["transform", "transition", "transitionduration", "transitionproperty"],
l = function () {
for (var t = {}, e = 0, i = c.length; i > e; e++) {
var n = c[e],
r = o(n);
r && r !== n && (t[n] = r)
}
return t
}();
e(i.prototype, r.prototype), i.prototype._create = function () {
this.css({
position: "absolute"
})
}, i.prototype.handleevent = function (t) {
var e = "on" + t.type;
this[e] && this[e](t)
}, i.prototype.getsize = function () {
this.size = n(this.element)
}, i.prototype.css = function (t) {
var e = this.element.style;
for (var i in t) {
var n = l[i] || i;
e[n] = t[i]
}
}, i.prototype.getposition = function () {
var t = a(this.element),
e = this.layout.options,
i = e.isoriginleft,
n = e.isorigintop,
o = parseint(t[i ? "left" : "right"], 10),
r = parseint(t[n ? "top" : "bottom"], 10);
o = isnan(o) ? 0 : o, r = isnan(r) ? 0 : r;
var s = this.layout.size;
o -= i ? s.paddingleft : s.paddingright, r -= n ? s.paddingtop : s.paddingbottom, this.position.x = o, this.position.y = r
}, i.prototype.layoutposition = function () {
var t = this.layout.size,
e = this.layout.options,
i = {};
e.isoriginleft ? (i.left = this.position.x + t.paddingleft + "px", i.right = "") : (i.right = this.position.x + t.paddingright + "px", i.left = ""), e.isorigintop ? (i.top = this.position.y + t.paddingtop + "px", i.bottom = "") : (i.bottom = this.position.y + t.paddingbottom + "px", i.top = ""), this.css(i), this.emitevent("layout", [this])
};
var m = f ? function (t, e) {
return "translate3d(" + t + "px, " + e + "px, 0)"
} : function (t, e) {
return "translate(" + t + "px, " + e + "px)"
};
i.prototype._transitionto = function (t, e) {
this.getposition();
var i = this.position.x,
n = this.position.y,
o = parseint(t, 10),
r = parseint(e, 10),
s = o === this.position.x && r === this.position.y;
if (this.setposition(t, e), s && !this.istransitioning) return this.layoutposition(), void 0;
var a = t - i,
h = e - n,
p = {},
u = this.layout.options;
a = u.isoriginleft ? a : -a, h = u.isorigintop ? h : -h, p.transform = m(a, h), this.transition({
to: p,
ontransitionend: this.layoutposition,
iscleaning: !0
})
}, i.prototype.goto = function (t, e) {
this.setposition(t, e), this.layoutposition()
}, i.prototype.moveto = u ? i.prototype._transitionto : i.prototype.goto, i.prototype.setposition = function (t, e) {
this.position.x = parseint(t, 10), this.position.y = parseint(e, 10)
}, i.prototype._nontransition = function (t) {
this.css(t.to), t.iscleaning && this._removestyles(t.to), t.ontransitionend && t.ontransitionend.call(this)
}, i.prototype._transition = function (t) {
var e = this.layout.options.transitionduration;
if (!parsefloat(e)) return this._nontransition(t), void 0;
var i = t.to,
n = [];
for (var o in i) n.push(o);
var r = {};
if (r.transitionproperty = n.join(","), r.transitionduration = e, this.element.addeventlistener(d, this, !1), (t.iscleaning || t.ontransitionend) && this.on("transitionend", function (e) {
return t.iscleaning && e._removestyles(i), t.ontransitionend && t.ontransitionend.call(e), !0
}), t.from) {
this.css(t.from);
var s = this.element.offsetheight;
s = null
}
this.css(r), this.css(i), this.istransitioning = !0
}, i.prototype.transition = i.prototype[h ? "_transition" : "_nontransition"], i.prototype.onwebkittransitionend = function (t) {
this.ontransitionend(t)
}, i.prototype.onotransitionend = function (t) {
this.ontransitionend(t)
}, i.prototype.ontransitionend = function (t) {
t.target === this.element && (this.removetransitionstyles(), this.element.removeeventlistener(d, this, !1), this.istransitioning = !1, this.emitevent("transitionend", [this]))
}, i.prototype._removestyles = function (t) {
var e = {};
for (var i in t) e[i] = "";
this.css(e)
};
var y = {
transitionproperty: "",
transitionduration: ""
};
i.prototype.removetransitionstyles = function () {
this.css(y)
}, i.prototype.removeelem = function () {
this.element.parentnode.removechild(this.element), this.emitevent("remove", [this])
}, i.prototype.remove = h ? function () {
var t = this;
this.on("transitionend", function () {
return t.removeelem(), !0
}), this.hide()
} : i.prototype.removeelem, i.prototype.reveal = function () {
this.css({
display: ""
});
var t = this.layout.options;
this.transition({
from: t.hiddenstyle,
to: t.visiblestyle,
iscleaning: !0
})
}, i.prototype.hide = function () {
this.css({
display: ""
});
var t = this.layout.options;
this.transition({
from: t.visiblestyle,
to: t.hiddenstyle,
iscleaning: !0,
ontransitionend: function () {
this.css({
display: "none"
})
}
})
}, i.prototype.destroy = function () {
this.css({
position: "",
left: "",
right: "",
top: "",
bottom: "",
transition: "",
transform: ""
})
}, t.outlayer = {
item: i
}
}(window),
function (t) {
"use strict";
function e(t, e) {
for (var i in e) t[i] = e[i];
return t
}
function i(t) {
return "[object array]" === v.call(t)
}
function n(t) {
var e = [];
if (i(t)) e = t;
else if ("number" == typeof t.length)
for (var n = 0, o = t.length; o > n; n++) e.push(t[n]);
else e.push(t);
return e
}
function o(t) {
return t.replace(/(.)([a-z])/g, function (t, e, i) {
return e + "-" + i
}).tolowercase()
}
function r(t, i) {
if ("string" == typeof t && (t = l.queryselector(t)), !t || !_(t)) return m && m.error("bad " + this.settings.namespace + " element: " + t), void 0;
this.element = t, this.options = e({}, this.options), e(this.options, i);
var n = ++l;
this.element.outlayerguid = n, e[n] = this, this._create(), this.options.isinitlayout && this.layout()
}
function s(t, i) {
t.prototype[i] = e({}, r.prototype[i])
}
var a = t.outlayer,
h = a.item,
p = t.docready,
u = t.eventemitter,
f = t.eventie,
d = t.getsize,
c = t.matchesselector,
l = t.document,
m = t.console,
y = t.jquery,
g = function () {},
v = object.prototype.tostring,
_ = "object" == typeof htmlelement ? function (t) {
return t instanceof htmlelement
} : function (t) {
return t && "object" == typeof t && 1 === t.nodetype && "string" == typeof t.nodename
},
b = array.prototype.indexof ? function (t, e) {
return t.indexof(e)
} : function (t, e) {
for (var i = 0, n = t.length; n > i; i++)
if (t[i] === e) return i;
return -1
},
l = 0,
e = {};
r.prototype.settings = {
namespace: "outlayer",
item: a.item
}, r.prototype.options = {
containerstyle: {
position: "relative"
},
isinitlayout: !0,
isoriginleft: !0,
isorigintop: !0,
isresizebound: !0,
transitionduration: "0.4s",
hiddenstyle: {
opacity: 0,
transform: "scale(0.001)"
},
visiblestyle: {
opacity: 1,
transform: "scale(1)"
}
}, e(r.prototype, u.prototype), r.prototype._create = function () {
this.reloaditems(), this.stamps = [], this.stamp(this.options.stamp), e(this.element.style, this.options.containerstyle), this.options.isresizebound && this.bindresize()
}, r.prototype.reloaditems = function () {
this.items = this._getitems(this.element.children)
}, r.prototype._getitems = function (t) {
for (var e = this._filterfinditemelements(t), i = this.settings.item, n = [], o = 0, r = e.length; r > o; o++) {
var s = e[o],
a = new i(s, this, this.options.itemoptions);
n.push(a)
}
return n
}, r.prototype._filterfinditemelements = function (t) {
t = n(t);
var e = this.options.itemselector;
if (!e) return t;
for (var i = [], o = 0, r = t.length; r > o; o++) {
var s = t[o];
c(s, e) && i.push(s);
for (var a = s.queryselectorall(e), h = 0, p = a.length; p > h; h++) i.push(a[h])
}
return i
}, r.prototype.getitemelements = function () {
for (var t = [], e = 0, i = this.items.length; i > e; e++) t.push(this.items[e].element);
return t
}, r.prototype.layout = function () {
this._resetlayout(), this._managestamps();
var t = void 0 !== this.options.islayoutinstant ? this.options.islayoutinstant : !this._islayoutinited;
this.layoutitems(this.items, t), this._islayoutinited = !0
}, r.prototype._init = r.prototype.layout, r.prototype._resetlayout = function () {
this.getsize()
}, r.prototype.getsize = function () {
this.size = d(this.element)
}, r.prototype._getmeasurement = function (t, e) {
var i, n = this.options[t];
n ? ("string" == typeof n ? i = this.element.queryselector(n) : _(n) && (i = n), this[t] = i ? d(i)[e] : n) : this[t] = 0
}, r.prototype.layoutitems = function (t, e) {
t = this._getitemsforlayout(t), this._layoutitems(t, e), this._postlayout()
}, r.prototype._getitemsforlayout = function (t) {
for (var e = [], i = 0, n = t.length; n > i; i++) {
var o = t[i];
o.isignored || e.push(o)
}
return e
}, r.prototype._layoutitems = function (t, e) {
if (!t || !t.length) return this.emitevent("layoutcomplete", [this, t]), void 0;
this._itemson(t, "layout", function () {
this.emitevent("layoutcomplete", [this, t])
});
for (var i = [], n = 0, o = t.length; o > n; n++) {
var r = t[n],
s = this._getitemlayoutposition(r);
s.item = r, s.isinstant = e, i.push(s)
}
this._processlayoutqueue(i)
}, r.prototype._getitemlayoutposition = function () {
return {
x: 0,
y: 0
}
}, r.prototype._processlayoutqueue = function (t) {
for (var e = 0, i = t.length; i > e; e++) {
var n = t[e];
this._positionitem(n.item, n.x, n.y, n.isinstant)
}
}, r.prototype._positionitem = function (t, e, i, n) {
n ? t.goto(e, i) : t.moveto(e, i)
}, r.prototype._postlayout = function () {
var t = this._getcontainersize();
t && (this._setcontainermeasure(t.width, !0), this._setcontainermeasure(t.height, !1))
}, r.prototype._getcontainersize = g, r.prototype._setcontainermeasure = function (t, e) {
if (void 0 !== t) {
var i = this.size;
i.isborderbox && (t += e ? i.paddingleft + i.paddingright + i.borderleftwidth + i.borderrightwidth : i.paddingbottom + i.paddingtop + i.bordertopwidth + i.borderbottomwidth), t = math.max(t, 0), this.element.style[e ? "width" : "height"] = t + "px"
}
}, r.prototype._itemson = function (t, e, i) {
function n() {
return o++, o === r && i.call(s), !0
}
for (var o = 0, r = t.length, s = this, a = 0, h = t.length; h > a; a++) {
var p = t[a];
p.on(e, n)
}
}, r.prototype.ignore = function (t) {
var e = this.getitem(t);
e && (e.isignored = !0)
}, r.prototype.unignore = function (t) {
var e = this.getitem(t);
e && delete e.isignored
}, r.prototype.stamp = function (t) {
if (t = this._find(t)) {
this.stamps = this.stamps.concat(t);
for (var e = 0, i = t.length; i > e; e++) {
var n = t[e];
this.ignore(n)
}
}
}, r.prototype.unstamp = function (t) {
if (t = this._find(t))
for (var e = 0, i = t.length; i > e; e++) {
var n = t[e],
o = b(this.stamps, n); - 1 !== o && this.stamps.splice(o, 1), this.unignore(n)
}
}, r.prototype._find = function (t) {
return t ? ("string" == typeof t && (t = this.element.queryselectorall(t)), t = n(t)) : void 0
}, r.prototype._managestamps = function () {
if (this.stamps && this.stamps.length) {
this._getboundingrect();
for (var t = 0, e = this.stamps.length; e > t; t++) {
var i = this.stamps[t];
this._managestamp(i)
}
}
}, r.prototype._getboundingrect = function () {
var t = this.element.getboundingclientrect(),
e = this.size;
this._boundingrect = {
left: t.left + e.paddingleft + e.borderleftwidth,
top: t.top + e.paddingtop + e.bordertopwidth,
right: t.right - (e.paddingright + e.borderrightwidth),
bottom: t.bottom - (e.paddingbottom + e.borderbottomwidth)
}
}, r.prototype._managestamp = g, r.prototype._getelementoffset = function (t) {
var e = t.getboundingclientrect(),
i = this._boundingrect,
n = d(t),
o = {
left: e.left - i.left - n.marginleft,
top: e.top - i.top - n.margintop,
right: i.right - e.right - n.marginright,
bottom: i.bottom - e.bottom - n.marginbottom
};
return o
}, r.prototype.handleevent = function (t) {
var e = "on" + t.type;
this[e] && this[e](t)
}, r.prototype.bindresize = function () {
this.isresizebound || (f.bind(t, "resize", this), this.isresizebound = !0)
}, r.prototype.unbindresize = function () {
f.unbind(t, "resize", this), this.isresizebound = !1
}, r.prototype.onresize = function () {
function t() {
e.resize()
}
this.resizetimeout && cleartimeout(this.resizetimeout);
var e = this;
this.resizetimeout = settimeout(t, 100)
}, r.prototype.resize = function () {
var t = d(this.element),
e = this.size && t;
e && t.innerwidth === this.size.innerwidth || (this.layout(), delete this.resizetimeout)
}, r.prototype.additems = function (t) {
var e = this._getitems(t);
if (e.length) return this.items = this.items.concat(e), e
}, r.prototype.appended = function (t) {
var e = this.additems(t);
e.length && (this.layoutitems(e, !0), this.reveal(e))
}, r.prototype.prepended = function (t) {
var e = this._getitems(t);
if (e.length) {
var i = this.items.slice(0);
this.items = e.concat(i), this._resetlayout(), this.layoutitems(e, !0), this.reveal(e), this.layoutitems(i)
}
}, r.prototype.reveal = function (t) {
if (t && t.length)
for (var e = 0, i = t.length; i > e; e++) {
var n = t[e];
n.reveal()
}
}, r.prototype.hide = function (t) {
if (t && t.length)
for (var e = 0, i = t.length; i > e; e++) {
var n = t[e];
n.hide()
}
}, r.prototype.getitem = function (t) {
for (var e = 0, i = this.items.length; i > e; e++) {
var n = this.items[e];
if (n.element === t) return n
}
}, r.prototype.getitems = function (t) {
if (t && t.length) {
for (var e = [], i = 0, n = t.length; n > i; i++) {
var o = t[i],
r = this.getitem(o);
r && e.push(r)
}
return e
}
}, r.prototype.remove = function (t) {
t = n(t);
var e = this.getitems(t);
this._itemson(e, "remove", function () {
this.emitevent("removecomplete", [this, e])
});
for (var i = 0, o = e.length; o > i; i++) {
var r = e[i];
r.remove();
var s = b(this.items, r);
this.items.splice(s, 1)
}
}, r.prototype.destroy = function () {
var t = this.element.style;
t.height = "", t.position = "", t.width = "";
for (var e = 0, i = this.items.length; i > e; e++) {
var n = this.items[e];
n.destroy()
}
this.unbindresize(), delete this.element.outlayerguid
}, r.data = function (t) {
var e = t && t.outlayerguid;
return e && e[e]
}, r.create = function (t, i) {
function n() {
r.apply(this, arguments)
}
return e(n.prototype, r.prototype), s(n, "options"), s(n, "settings"), e(n.prototype.options, i), n.prototype.settings.namespace = t, n.data = r.data, n.item = function () {
h.apply(this, arguments)
}, n.item.prototype = new r.item, n.prototype.settings.item = n.item, p(function () {
for (var e = o(t), i = l.queryselectorall(".js-" + e), r = "data-" + e + "-options", s = 0, a = i.length; a > s; s++) {
var h, p = i[s],
u = p.getattribute(r);
try {
h = u && json.parse(u)
} catch (f) {
m && m.error("error parsing " + r + " on " + p.nodename.tolowercase() + (p.id ? "#" + p.id : "") + ": " + f);
continue
}
var d = new n(p, h);
y && y.data(p, t, d)
}
}), y && y.bridget && y.bridget(t, n), n
}, r.item = h, t.outlayer = r
}(window),
function (t) {
"use strict";
function e(t, e) {
var n = t.create("masonry");
return n.prototype._resetlayout = function () {
this.getsize(), this._getmeasurement("columnwidth", "outerwidth"), this._getmeasurement("gutter", "outerwidth"), this.measurecolumns();
var t = this.cols;
for (this.colys = []; t--;) this.colys.push(0);
this.maxy = 0
}, n.prototype.measurecolumns = function () {
var t = this.items[0].element;
this.columnwidth = this.columnwidth || e(t).outerwidth, this.columnwidth += this.gutter, this.cols = math.floor((this.size.innerwidth + this.gutter) / this.columnwidth), this.cols = math.max(this.cols, 1)
}, n.prototype._getitemlayoutposition = function (t) {
t.getsize();
var e = math.ceil(t.size.outerwidth / this.columnwidth);
e = math.min(e, this.cols);
for (var n = this._getcolgroup(e), o = math.min.apply(math, n), r = i(n, o), s = {
x: this.columnwidth * r,
y: o
}, a = o + t.size.outerheight, h = this.cols + 1 - n.length, p = 0; h > p; p++) this.colys[r + p] = a;
return s
}, n.prototype._getcolgroup = function (t) {
if (1 === t) return this.colys;
for (var e = [], i = this.cols + 1 - t, n = 0; i > n; n++) {
var o = this.colys.slice(n, n + t);
e[n] = math.max.apply(math, o)
}
return e
}, n.prototype._managestamp = function (t) {
var i = e(t),
n = this._getelementoffset(t),
o = this.options.isoriginleft ? n.left : n.right,
r = o + i.outerwidth,
s = math.floor(o / this.columnwidth);
s = math.max(0, s);
var a = math.floor(r / this.columnwidth);
a = math.min(this.cols - 1, a);
for (var h = (this.options.isorigintop ? n.top : n.bottom) + i.outerheight, p = s; a >= p; p++) this.colys[p] = math.max(h, this.colys[p])
}, n.prototype._getcontainersize = function () {
return this.maxy = math.max.apply(math, this.colys), {
height: this.maxy
}
}, n
}
var i = array.prototype.indexof ? function (t, e) {
return t.indexof(e)
} : function (t, e) {
for (var i = 0, n = t.length; n > i; i++) {
var o = t[i];
if (o === e) return i
}
return -1
};
"function" == typeof define && define.amd ? define(["outlayer", "get-size"], e) : t.masonry = e(t.outlayer, t.getsize)
}(window);
/*!
* imagesloaded v3.0.2
* javascript is all like "you images are done yet or what?"
*/
( function( window ) {
'use strict';
var $ = window.jquery;
var console = window.console;
var hasconsole = typeof console !== 'undefined';
// -------------------------- helpers -------------------------- //
// extend objects
function extend( a, b ) {
for ( var prop in b ) {
a[ prop ] = b[ prop ];
}
return a;
}
var objtostring = object.prototype.tostring;
function isarray( obj ) {
return objtostring.call( obj ) === '[object array]';
}
// turn element or nodelist into an array
function makearray( obj ) {
var ary = [];
if ( isarray( obj ) ) {
// use object if already an array
ary = obj;
} else if ( typeof obj.length === 'number' ) {
// convert nodelist to array
for ( var i=0, len = obj.length; i < len; i++ ) {
ary.push( obj[i] );
}
} else {
// array of single index
ary.push( obj );
}
return ary;
}
// -------------------------- -------------------------- //
function defineimagesloaded( eventemitter, eventie ) {
/**
* @param {array, element, nodelist, string} elem
* @param {object or function} options - if function, use as callback
* @param {function} onalways - callback function
*/
function imagesloaded( elem, options, onalways ) {
// coerce imagesloaded() without new, to be new imagesloaded()
if ( !( this instanceof imagesloaded ) ) {
return new imagesloaded( elem, options );
}
// use elem as selector string
if ( typeof elem === 'string' ) {
elem = document.queryselectorall( elem );
}
this.elements = makearray( elem );
this.options = extend( {}, this.options );
if ( typeof options === 'function' ) {
onalways = options;
} else {
extend( this.options, options );
}
if ( onalways ) {
this.on( 'always', onalways );
}
this.getimages();
if ( $ ) {
// add jquery deferred object
this.jqdeferred = new $.deferred();
}
// hack check async to allow time to bind listeners
var _this = this;
settimeout( function() {
_this.check();
});
}
imagesloaded.prototype = new eventemitter();
imagesloaded.prototype.options = {};
imagesloaded.prototype.getimages = function() {
this.images = [];
// filter & find items if we have an item selector
for ( var i=0, len = this.elements.length; i < len; i++ ) {
var elem = this.elements[i];
// filter siblings
if ( elem.nodename === 'img' ) {
this.addimage( elem );
}
// find children
var childelems = elem.queryselectorall('img');
// concat childelems to filterfound array
for ( var j=0, jlen = childelems.length; j < jlen; j++ ) {
var img = childelems[j];
this.addimage( img );
}
}
};
/**
* @param {image} img
*/
imagesloaded.prototype.addimage = function( img ) {
var loadingimage = new loadingimage( img );
this.images.push( loadingimage );
};
imagesloaded.prototype.check = function() {
var _this = this;
var checkedcount = 0;
var length = this.images.length;
this.hasanybroken = false;
// complete if no images
if ( !length ) {
this.complete();
return;
}
function onconfirm( image, message ) {
if ( _this.options.debug && hasconsole ) {
console.log( 'confirm', image, message );
}
_this.progress( image );
checkedcount++;
if ( checkedcount === length ) {
_this.complete();
}
return true; // bind once
}
for ( var i=0; i < length; i++ ) {
var loadingimage = this.images[i];
loadingimage.on( 'confirm', onconfirm );
loadingimage.check();
}
};
imagesloaded.prototype.progress = function( image ) {
this.hasanybroken = this.hasanybroken || !image.isloaded;
this.emit( 'progress', this, image );
if ( this.jqdeferred ) {
this.jqdeferred.notify( this, image );
}
};
imagesloaded.prototype.complete = function() {
var eventname = this.hasanybroken ? 'fail' : 'done';
this.iscomplete = true;
this.emit( eventname, this );
this.emit( 'always', this );
if ( this.jqdeferred ) {
var jqmethod = this.hasanybroken ? 'reject' : 'resolve';
this.jqdeferred[ jqmethod ]( this );
}
};
// -------------------------- jquery -------------------------- //
if ( $ ) {
$.fn.imagesloaded = function( options, callback ) {
var instance = new imagesloaded( this, options, callback );
return instance.jqdeferred.promise( $(this) );
};
}
// -------------------------- -------------------------- //
var cache = {};
function loadingimage( img ) {
this.img = img;
}
loadingimage.prototype = new eventemitter();
loadingimage.prototype.check = function() {
// first check cached any previous images that have same src
var cached = cache[ this.img.src ];
if ( cached ) {
this.usecached( cached );
return;
}
// add this to cache
cache[ this.img.src ] = this;
// if complete is true and browser supports natural sizes,
// try to check for image status manually.
if ( this.img.complete && this.img.naturalwidth !== undefined ) {
// report based on naturalwidth
this.confirm( this.img.naturalwidth !== 0, 'naturalwidth' );
return;
}
// if none of the checks above matched, simulate loading on detached element.
var proxyimage = this.proxyimage = new image();
eventie.bind( proxyimage, 'load', this );
eventie.bind( proxyimage, 'error', this );
proxyimage.src = this.img.src;
};
loadingimage.prototype.usecached = function( cached ) {
if ( cached.isconfirmed ) {
this.confirm( cached.isloaded, 'cached was confirmed' );
} else {
var _this = this;
cached.on( 'confirm', function( image ) {
_this.confirm( image.isloaded, 'cache emitted confirmed' );
return true; // bind once
});
}
};
loadingimage.prototype.confirm = function( isloaded, message ) {
this.isconfirmed = true;
this.isloaded = isloaded;
this.emit( 'confirm', this, message );
};
// trigger specified handler for event type
loadingimage.prototype.handleevent = function( event ) {
var method = 'on' + event.type;
if ( this[ method ] ) {
this[ method ]( event );
}
};
loadingimage.prototype.onload = function() {
this.confirm( true, 'onload' );
this.unbindproxyevents();
};
loadingimage.prototype.onerror = function() {
this.confirm( false, 'onerror' );
this.unbindproxyevents();
};
loadingimage.prototype.unbindproxyevents = function() {
eventie.unbind( this.proxyimage, 'load', this );
eventie.unbind( this.proxyimage, 'error', this );
};
// ----- ----- //
return imagesloaded;
}
// -------------------------- transport -------------------------- //
if ( typeof define === 'function' && define.amd ) {
// amd
define( [
'eventemitter',
'eventie'
],
defineimagesloaded );
} else {
// browser global
window.imagesloaded = defineimagesloaded(
window.eventemitter,
window.eventie
);
}
})( window );
/*!
* classie - class helper functions
* from bonzo https://github.com/ded/bonzo
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
* classie.toggle( elem, 'my-class' )
*/
/*jshint browser: true, strict: true, undef: true */
/*global define: false */
( function( window ) {
'use strict';
// class helper functions from bonzo https://github.com/ded/bonzo
function classreg( classname ) {
return new regexp("(^|\\s+)" + classname + "(\\s+|$)");
}
// classlist support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasclass, addclass, removeclass;
if ( 'classlist' in document.documentelement ) {
hasclass = function( elem, c ) {
return elem.classlist.contains( c );
};
addclass = function( elem, c ) {
elem.classlist.add( c );
};
removeclass = function( elem, c ) {
elem.classlist.remove( c );
};
}
else {
hasclass = function( elem, c ) {
return classreg( c ).test( elem.classname );
};
addclass = function( elem, c ) {
if ( !hasclass( elem, c ) ) {
elem.classname = elem.classname + ' ' + c;
}
};
removeclass = function( elem, c ) {
elem.classname = elem.classname.replace( classreg( c ), ' ' );
};
}
function toggleclass( elem, c ) {
var fn = hasclass( elem, c ) ? removeclass : addclass;
fn( elem, c );
}
var classie = {
// full names
hasclass: hasclass,
addclass: addclass,
removeclass: removeclass,
toggleclass: toggleclass,
// short names
has: hasclass,
add: addclass,
remove: removeclass,
toggle: toggleclass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// amd
define( classie );
} else {
// browser global
window.classie = classie;
}
})( window );
/**
* animonscroll.js v1.0.0
* http://www.codrops.com
*
* licensed under the mit license.
* http://www.opensource.org/licenses/mit-license.php
*
* copyright 2013, codrops
* http://www.codrops.com
*/
;( function( window ) {
'use strict';
var docelem = window.document.documentelement;
function getviewporth() {
var client = docelem['clientheight'],
inner = window['innerheight'];
if( client < inner )
return inner;
else
return client;
}
function scrolly() {
return window.pageyoffset || docelem.scrolltop;
}
// http://stackoverflow.com/a/5598797/989439
function getoffset( el ) {
var offsettop = 0, offsetleft = 0;
do {
if ( !isnan( el.offsettop ) ) {
offsettop += el.offsettop;
}
if ( !isnan( el.offsetleft ) ) {
offsetleft += el.offsetleft;
}
} while( el = el.offsetparent )
return {
top : offsettop,
left : offsetleft
}
}
function inviewport( el, h ) {
var elh = el.offsetheight,
scrolled = scrolly(),
viewed = scrolled + getviewporth(),
eltop = getoffset(el).top,
elbottom = eltop + elh,
// if 0, the element is considered in the viewport as soon as it enters.
// if 1, the element is considered in the viewport only when it's fully inside
// value in percentage (1 >= h >= 0)
h = h || 0;
return (eltop + elh * h) <= viewed && (elbottom - elh * h) >= scrolled;
}
function extend( a, b ) {
for( var key in b ) {
if( b.hasownproperty( key ) ) {
a[key] = b[key];
}
}
return a;
}
function animonscroll( el, options ) {
this.el = el;
this.options = extend( this.defaults, options );
this._init();
}
animonscroll.prototype = {
defaults : {
// minimum and a maximum duration of the animation (random value is chosen)
minduration : 0,
maxduration : 0,
// the viewportfactor defines how much of the appearing item has to be visible in order to trigger the animation
// if we'd use a value of 0, this would mean that it would add the animation class as soon as the item is in the viewport.
// if we were to use the value of 1, the animation would only be triggered when we see all of the item in the viewport (100% of it)
viewportfactor : 0
},
_init : function() {
this.items = array.prototype.slice.call( document.queryselectorall( '#' + this.el.id + ' > li' ) );
this.itemscount = this.items.length;
this.itemsrenderedcount = 0;
this.didscroll = false;
var self = this;
imagesloaded( this.el, function() {
// initialize masonry
new masonry( self.el, {
itemselector: 'li',
transitionduration : 0
} );
if( modernizr.cssanimations ) {
// the items already shown...
self.items.foreach( function( el, i ) {
if( inviewport( el ) ) {
self._checktotalrendered();
classie.add( el, 'shown' );
}
} );
// animate on scroll the items inside the viewport
window.addeventlistener( 'scroll', function() {
self._onscrollfn();
}, false );
window.addeventlistener( 'resize', function() {
self._resizehandler();
}, false );
}
});
},
_onscrollfn : function() {
var self = this;
if( !this.didscroll ) {
this.didscroll = true;
settimeout( function() { self._scrollpage(); }, 60 );
}
},
_scrollpage : function() {
var self = this;
this.items.foreach( function( el, i ) {
if( !classie.has( el, 'shown' ) && !classie.has( el, 'animate' ) && inviewport( el, self.options.viewportfactor ) ) {
settimeout( function() {
var perspy = scrolly() + getviewporth() / 2;
self.el.style.webkitperspectiveorigin = '50% ' + perspy + 'px';
self.el.style.mozperspectiveorigin = '50% ' + perspy + 'px';
self.el.style.perspectiveorigin = '50% ' + perspy + 'px';
self._checktotalrendered();
if( self.options.minduration && self.options.maxduration ) {
var randduration = ( math.random() * ( self.options.maxduration - self.options.minduration ) + self.options.minduration ) + 's';
el.style.webkitanimationduration = randduration;
el.style.mozanimationduration = randduration;
el.style.animationduration = randduration;
}
classie.add( el, 'animate' );
}, 25 );
}
});
this.didscroll = false;
},
_resizehandler : function() {
var self = this;
function delayed() {
self._scrollpage();
self.resizetimeout = null;
}
if ( this.resizetimeout ) {
cleartimeout( this.resizetimeout );
}
this.resizetimeout = settimeout( delayed, 1000 );
},
_checktotalrendered : function() {
++this.itemsrenderedcount;
if( this.itemsrenderedcount === this.itemscount ) {
window.removeeventlistener( 'scroll', this._onscrollfn );
}
}
}
// add to global namespace
window.animonscroll = animonscroll;
} )( window );
new animonscroll(document.getelementbyid('grid'), {
minduration: 0.4,
maxduration: 0.7,
viewportfactor: 0.2
});