/*! waypoints - 4.0.0 copyright 漏 2011-2015 caleb troughton licensed under the mit license. https://github.com/imakewebthings/waypoints/blob/master/licenses.txt */ ! function () { "use strict"; function t(o) { if (!o) throw new error("no options passed to waypoint constructor"); if (!o.element) throw new error("no element option passed to waypoint constructor"); if (!o.handler) throw new error("no handler option passed to waypoint constructor"); this.key = "waypoint-" + e, this.options = t.adapter.extend({}, t.defaults, o), this.element = this.options.element, this.adapter = new t.adapter(this.element), this.callback = o.handler, this.axis = this.options.horizontal ? "horizontal" : "vertical", this.enabled = this.options.enabled, this.triggerpoint = null, this.group = t.group.findorcreate({ name: this.options.group, axis: this.axis }), this.context = t.context.findorcreatebyelement(this.options.context), t.offsetaliases[this.options.offset] && (this.options.offset = t.offsetaliases[this.options.offset]), this.group.add(this), this.context.add(this), i[this.key] = this, e += 1 } var e = 0, i = {}; t.prototype.queuetrigger = function (t) { this.group.queuetrigger(this, t) }, t.prototype.trigger = function (t) { this.enabled && this.callback && this.callback.apply(this, t) }, t.prototype.destroy = function () { this.context.remove(this), this.group.remove(this), delete i[this.key] }, t.prototype.disable = function () { return this.enabled = !1, this }, t.prototype.enable = function () { return this.context.refresh(), this.enabled = !0, this }, t.prototype.next = function () { return this.group.next(this) }, t.prototype.previous = function () { return this.group.previous(this) }, t.invokeall = function (t) { var e = []; for (var o in i) e.push(i[o]); for (var n = 0, r = e.length; r > n; n++) e[n][t]() }, t.destroyall = function () { t.invokeall("destroy") }, t.disableall = function () { t.invokeall("disable") }, t.enableall = function () { t.invokeall("enable") }, t.refreshall = function () { t.context.refreshall() }, t.viewportheight = function () { return window.innerheight || document.documentelement.clientheight }, t.viewportwidth = function () { return document.documentelement.clientwidth }, t.adapters = [], t.defaults = { context: window, continuous: !0, enabled: !0, group: "default", horizontal: !1, offset: 0 }, t.offsetaliases = { "bottom-in-view": function () { return this.context.innerheight() - this.adapter.outerheight() }, "right-in-view": function () { return this.context.innerwidth() - this.adapter.outerwidth() } }, window.waypoint = t }(), function () { "use strict"; function t(t) { window.settimeout(t, 1e3 / 60) } function e(t) { this.element = t, this.adapter = n.adapter, this.adapter = new this.adapter(t), this.key = "waypoint-context-" + i, this.didscroll = !1, this.didresize = !1, this.oldscroll = { x: this.adapter.scrollleft(), y: this.adapter.scrolltop() }, this.waypoints = { vertical: {}, horizontal: {} }, t.waypointcontextkey = this.key, o[t.waypointcontextkey] = this, i += 1, this.createthrottledscrollhandler(), this.createthrottledresizehandler() } var i = 0, o = {}, n = window.waypoint, r = window.onload; e.prototype.add = function (t) { var e = t.options.horizontal ? "horizontal" : "vertical"; this.waypoints[e][t.key] = t, this.refresh() }, e.prototype.checkempty = function () { var t = this.adapter.isemptyobject(this.waypoints.horizontal), e = this.adapter.isemptyobject(this.waypoints.vertical); t && e && (this.adapter.off(".waypoints"), delete o[this.key]) }, e.prototype.createthrottledresizehandler = function () { function t() { e.handleresize(), e.didresize = !1 } var e = this; this.adapter.on("resize.waypoints", function () { e.didresize || (e.didresize = !0, n.requestanimationframe(t)) }) }, e.prototype.createthrottledscrollhandler = function () { function t() { e.handlescroll(), e.didscroll = !1 } var e = this; this.adapter.on("scroll.waypoints", function () { (!e.didscroll || n.istouch) && (e.didscroll = !0, n.requestanimationframe(t)) }) }, e.prototype.handleresize = function () { n.context.refreshall() }, e.prototype.handlescroll = function () { var t = {}, e = { horizontal: { newscroll: this.adapter.scrollleft(), oldscroll: this.oldscroll.x, forward: "right", backward: "left" }, vertical: { newscroll: this.adapter.scrolltop(), oldscroll: this.oldscroll.y, forward: "down", backward: "up" } }; for (var i in e) { var o = e[i], n = o.newscroll > o.oldscroll, r = n ? o.forward : o.backward; for (var s in this.waypoints[i]) { var a = this.waypoints[i][s], l = o.oldscroll < a.triggerpoint, h = o.newscroll >= a.triggerpoint, p = l && h, u = !l && !h; (p || u) && (a.queuetrigger(r), t[a.group.id] = a.group) } } for (var c in t) t[c].flushtriggers(); this.oldscroll = { x: e.horizontal.newscroll, y: e.vertical.newscroll } }, e.prototype.innerheight = function () { return this.element == this.element.window ? n.viewportheight() : this.adapter.innerheight() }, e.prototype.remove = function (t) { delete this.waypoints[t.axis][t.key], this.checkempty() }, e.prototype.innerwidth = function () { return this.element == this.element.window ? n.viewportwidth() : this.adapter.innerwidth() }, e.prototype.destroy = function () { var t = []; for (var e in this.waypoints) for (var i in this.waypoints[e]) t.push(this.waypoints[e][i]); for (var o = 0, n = t.length; n > o; o++) t[o].destroy() }, e.prototype.refresh = function () { var t, e = this.element == this.element.window, i = e ? void 0 : this.adapter.offset(), o = {}; this.handlescroll(), t = { horizontal: { contextoffset: e ? 0 : i.left, contextscroll: e ? 0 : this.oldscroll.x, contextdimension: this.innerwidth(), oldscroll: this.oldscroll.x, forward: "right", backward: "left", offsetprop: "left" }, vertical: { contextoffset: e ? 0 : i.top, contextscroll: e ? 0 : this.oldscroll.y, contextdimension: this.innerheight(), oldscroll: this.oldscroll.y, forward: "down", backward: "up", offsetprop: "top" } }; for (var r in t) { var s = t[r]; for (var a in this.waypoints[r]) { var l, h, p, u, c, d = this.waypoints[r][a], f = d.options.offset, w = d.triggerpoint, y = 0, g = null == w; d.element !== d.element.window && (y = d.adapter.offset()[s.offsetprop]), "function" == typeof f ? f = f.apply(d) : "string" == typeof f && (f = parsefloat(f), d.options.offset.indexof("%") > -1 && (f = math.ceil(s.contextdimension * f / 100))), l = s.contextscroll - s.contextoffset, d.triggerpoint = y + l - f, h = w < s.oldscroll, p = d.triggerpoint >= s.oldscroll, u = h && p, c = !h && !p, !g && u ? (d.queuetrigger(s.backward), o[d.group.id] = d.group) : !g && c ? (d.queuetrigger(s.forward), o[d.group.id] = d.group) : g && s.oldscroll >= d.triggerpoint && (d.queuetrigger(s.forward), o[d.group.id] = d.group) } } return n.requestanimationframe(function () { for (var t in o) o[t].flushtriggers() }), this }, e.findorcreatebyelement = function (t) { return e.findbyelement(t) || new e(t) }, e.refreshall = function () { for (var t in o) o[t].refresh() }, e.findbyelement = function (t) { return o[t.waypointcontextkey] }, window.onload = function () { r && r(), e.refreshall() }, n.requestanimationframe = function (e) { var i = window.requestanimationframe || window.mozrequestanimationframe || window.webkitrequestanimationframe || t; i.call(window, e) }, n.context = e }(), function () { "use strict"; function t(t, e) { return t.triggerpoint - e.triggerpoint } function e(t, e) { return e.triggerpoint - t.triggerpoint } function i(t) { this.name = t.name, this.axis = t.axis, this.id = this.name + "-" + this.axis, this.waypoints = [], this.cleartriggerqueues(), o[this.axis][this.name] = this } var o = { vertical: {}, horizontal: {} }, n = window.waypoint; i.prototype.add = function (t) { this.waypoints.push(t) }, i.prototype.cleartriggerqueues = function () { this.triggerqueues = { up: [], down: [], left: [], right: [] } }, i.prototype.flushtriggers = function () { for (var i in this.triggerqueues) { var o = this.triggerqueues[i], n = "up" === i || "left" === i; o.sort(n ? e : t); for (var r = 0, s = o.length; s > r; r += 1) { var a = o[r]; (a.options.continuous || r === o.length - 1) && a.trigger([i]) } } this.cleartriggerqueues() }, i.prototype.next = function (e) { this.waypoints.sort(t); var i = n.adapter.inarray(e, this.waypoints), o = i === this.waypoints.length - 1; return o ? null : this.waypoints[i + 1] }, i.prototype.previous = function (e) { this.waypoints.sort(t); var i = n.adapter.inarray(e, this.waypoints); return i ? this.waypoints[i - 1] : null }, i.prototype.queuetrigger = function (t, e) { this.triggerqueues[e].push(t) }, i.prototype.remove = function (t) { var e = n.adapter.inarray(t, this.waypoints); e > -1 && this.waypoints.splice(e, 1) }, i.prototype.first = function () { return this.waypoints[0] }, i.prototype.last = function () { return this.waypoints[this.waypoints.length - 1] }, i.findorcreate = function (t) { return o[t.axis][t.name] || new i(t) }, n.group = i }(), function () { "use strict"; function t(t) { this.$element = e(t) } var e = window.jquery, i = window.waypoint; e.each(["innerheight", "innerwidth", "off", "offset", "on", "outerheight", "outerwidth", "scrollleft", "scrolltop"], function (e, i) { t.prototype[i] = function () { var t = array.prototype.slice.call(arguments); return this.$element[i].apply(this.$element, t) } }), e.each(["extend", "inarray", "isemptyobject"], function (i, o) { t[o] = e[o] }), i.adapters.push({ name: "jquery", adapter: t }), i.adapter = t }(), function () { "use strict"; function t(t) { return function () { var i = [], o = arguments[0]; return t.isfunction(arguments[0]) && (o = t.extend({}, arguments[1]), o.handler = arguments[0]), this.each(function () { var n = t.extend({}, o, { element: this }); "string" == typeof n.context && (n.context = t(this).closest(n.context)[0]), i.push(new e(n)) }), i } } var e = window.waypoint; window.jquery && (window.jquery.fn.waypoint = t(window.jquery)), window.zepto && (window.zepto.fn.waypoint = t(window.zepto)) }();