/*! * Infinite Ajax Scroll v2.2.1 * A jQuery plugin for infinite scrolling * http://infiniteajaxscroll.com * * Commercial use requires one-time purchase of a commercial license * http://infiniteajaxscroll.com/docs/license.html * * Non-commercial use is licensed under the MIT License * * Copyright (c) 2015 Webcreate (Jeroen Fiege) */ ; var IASCallbacks = function() { return this.list = [], this.fireStack = [], this.isFiring = !1, this.isDisabled = !1, this.fire = function(h) { var g = h[0], l = h[1], k = h[2]; this.isFiring = !0; for (var j = 0, i = this.list.length; i > j; j++) { if (void 0 != this.list[j] && !1 === this.list[j].fn.apply(g, k)) { l.reject(); break } } this.isFiring = !1, l.resolve(), this.fireStack.length && this.fire(this.fireStack.shift()) }, this.inList = function(f, e) { e = e || 0; for (var h = e, g = this.list.length; g > h; h++) { if (this.list[h].fn === f || f.guid && this.list[h].fn.guid && f.guid === this.list[h].fn.guid) { return h } } return -1 }, this }; IASCallbacks.prototype = { add: function(g, f) { var j = { fn: g, priority: f }; f = f || 0; for (var i = 0, h = this.list.length; h > i; i++) { if (f > this.list[i].priority) { return this.list.splice(i, 0, j), this } } return this.list.push(j), this }, remove: function(d) { for (var c = 0; (c = this.inList(d, c)) > -1;) { this.list.splice(c, 1) } return this }, has: function(b) { return this.inList(b) > -1 }, fireWith: function(e, d) { var f = jQuery.Deferred(); return this.isDisabled ? f.reject() : (d = d || [], d = [e, f, d.slice ? d.slice() : d], this.isFiring ? this.fireStack.push(d) : this.fire(d), f) }, disable: function() { this.isDisabled = !0 }, enable: function() { this.isDisabled = !1 } }, function(e) { var d = -1, f = function(b, a) { return this.itemsContainerSelector = a.container, this.itemSelector = a.item, this.nextSelector = a.next, this.paginationSelector = a.pagination, this.$scrollContainer = b, this.$container = window === b.get(0) ? e(document) : b, this.defaultDelay = a.delay, this.negativeMargin = a.negativeMargin, this.nextUrl = null, this.isBound = !1, this.isPaused = !1, this.isInitialized = !1, this.listeners = { next: new IASCallbacks, load: new IASCallbacks, loaded: new IASCallbacks, render: new IASCallbacks, rendered: new IASCallbacks, scroll: new IASCallbacks, noneLeft: new IASCallbacks, ready: new IASCallbacks }, this.extensions = [], this.scrollHandler = function() { if (this.isBound && !this.isPaused) { var g = this.getCurrentScrollOffset(this.$scrollContainer), h = this.getScrollThreshold(); d != h && (this.fire("scroll", [g, h]), g >= h && this.next()) } }, this.getItemsContainer = function() { return e(this.itemsContainerSelector) }, this.getLastItem = function() { return e(this.itemSelector, this.getItemsContainer().get(0)).last() }, this.getFirstItem = function() { return e(this.itemSelector, this.getItemsContainer().get(0)).first() }, this.getScrollThreshold = function(g) { var h; return g = g || this.negativeMargin, g = g >= 0 ? -1 * g : g, h = this.getLastItem(), 0 === h.length ? d : h.offset().top + h.height() + g }, this.getCurrentScrollOffset = function(h) { var g = 0, i = h.height(); return g = window === h.get(0) ? h.scrollTop() : h.offset().top, (-1 != navigator.platform.indexOf("iPhone") || -1 != navigator.platform.indexOf("iPod")) && (i += 80), g + i }, this.getNextUrl = function(c) { return c = c || this.$container, e(this.nextSelector, c).last().attr("href") }, this.load = function(s, r, q) { var p, o, n = this, m = [], l = +new Date; q = q || this.defaultDelay; var k = { url: s }; return n.fire("load", [k]), e.get(k.url, null, e.proxy(function(c) { p = e(this.itemsContainerSelector, c).eq(0), 0 === p.length && (p = e(c).filter(this.itemsContainerSelector).eq(0)), p && p.find(this.itemSelector).each(function() { m.push(this) }), n.fire("loaded", [c, m]), r && (o = +new Date - l, q > o ? setTimeout(function() { r.call(n, c, m) }, q - o) : r.call(n, c, m)) }, n), "html") }, this.render = function(h, m) { var l = this, k = this.getLastItem(), j = 0, i = this.fire("render", [h]); i.done(function() { e(h).hide(), k.after(h), e(h).fadeIn(400, function() { ++j < h.length || (l.fire("rendered", [h]), m && m()) }) }) }, this.hidePagination = function() { this.paginationSelector && e(this.paginationSelector, this.$container).hide() }, this.restorePagination = function() { this.paginationSelector && e(this.paginationSelector, this.$container).show() }, this.throttle = function(g, k) { var j, i, h = 0; return j = function() { function c() { h = +new Date, g.apply(n, m) } var n = this, m = arguments, l = +new Date - h; i ? clearTimeout(i) : c(), l > k ? c() : i = setTimeout(c, k) }, e.guid && (j.guid = g.guid = g.guid || e.guid++), j }, this.fire = function(g, c) { return this.listeners[g].fireWith(this, c) }, this.pause = function() { this.isPaused = !0 }, this.resume = function() { this.isPaused = !1 }, this }; f.prototype.initialize = function() { if (this.isInitialized) { return !1 } var h = !!("onscroll" in this.$scrollContainer.get(0)), g = this.getCurrentScrollOffset(this.$scrollContainer), i = this.getScrollThreshold(); return h ? (this.hidePagination(), this.bind(), this.fire("ready"), this.nextUrl = this.getNextUrl(), g >= i ? (this.next(), this.one("rendered", function() { this.isInitialized = !0 })) : this.isInitialized = !0, this) : !1 }, f.prototype.reinitialize = function() { this.isInitialized = !1, this.unbind(), this.initialize() }, f.prototype.bind = function() { if (!this.isBound) { this.$scrollContainer.on("scroll", e.proxy(this.throttle(this.scrollHandler, 150), this)); for (var a = 0, g = this.extensions.length; g > a; a++) { this.extensions[a].bind(this) } this.isBound = !0, this.resume() } }, f.prototype.unbind = function() { if (this.isBound) { this.$scrollContainer.off("scroll", this.scrollHandler); for (var g = 0, c = this.extensions.length; c > g; g++) { "undefined" != typeof this.extensions[g].unbind && this.extensions[g].unbind(this) } this.isBound = !1 } }, f.prototype.destroy = function() { this.unbind(), this.$scrollContainer.data("ias", null) }, f.prototype.on = function(a, h, g) { if ("undefined" == typeof this.listeners[a]) { throw new Error('There is no event called "' + a + '"') } return g = g || 0, this.listeners[a].add(e.proxy(h, this), g), this }, f.prototype.one = function(h, g) { var j = this, i = function() { j.off(h, g), j.off(h, i) }; return this.on(h, g), this.on(h, i), this }, f.prototype.off = function(g, c) { if ("undefined" == typeof this.listeners[g]) { throw new Error('There is no event called "' + g + '"') } return this.listeners[g].remove(c), this }, f.prototype.next = function() { var h = this.nextUrl, g = this; if (this.pause(), !h) { return this.fire("noneLeft", [this.getLastItem()]), this.listeners.noneLeft.disable(), g.resume(), !1 } var i = this.fire("next", [h]); return i.done(function() { g.load(h, function(b, j) { g.render(j, function() { g.nextUrl = g.getNextUrl(b), g.resume() }) }) }), i.fail(function() { g.resume() }), !0 }, f.prototype.extension = function(b) { if ("undefined" == typeof b.bind) { throw new Error('Extension doesn\'t have required method "bind"') } return "undefined" != typeof b.initialize && b.initialize(this), this.extensions.push(b), this.isInitialized && this.reinitialize(), this }, e.ias = function(a) { var g = e(window); return g.ias.apply(g, arguments) }, e.fn.ias = function(a) { var g = Array.prototype.slice.call(arguments), c = this; return this.each(function() { var j = e(this), i = j.data("ias"), b = e.extend({}, e.fn.ias.defaults, j.data(), "object" == typeof a && a); if (i || (j.data("ias", i = new f(j, b)), e(document).ready(e.proxy(i.initialize, i))), "string" == typeof a) { if ("function" != typeof i[a]) { throw new Error('There is no method called "' + a + '"') } g.shift(), i[a].apply(i, g) } c = i }), c }, e.fn.ias.defaults = { item: ".item", container: ".listing", next: ".next", pagination: !1, delay: 600, negativeMargin: 10 } }(jQuery); var IASHistoryExtension = function(b) { return b = jQuery.extend({}, this.defaults, b), this.ias = null, this.prevSelector = b.prev, this.prevUrl = null, this.listeners = { prev: new IASCallbacks }, this.onPageChange = function(f, e, h) { if (window.history && window.history.replaceState) { var g = history.state; history.replaceState(g, document.title, h) } }, this.onScroll = function(e, d) { var f = this.getScrollThresholdFirstItem(); this.prevUrl && (e -= this.ias.$scrollContainer.height(), f >= e && this.prev()) }, this.onReady = function() { var d = this.ias.getCurrentScrollOffset(this.ias.$scrollContainer), c = this.getScrollThresholdFirstItem(); d -= this.ias.$scrollContainer.height(), c >= d && this.prev() }, this.getPrevUrl = function(c) { return c || (c = this.ias.$container), jQuery(this.prevSelector, c).last().attr("href") }, this.getScrollThresholdFirstItem = function() { var c; return c = this.ias.getFirstItem(), 0 === c.length ? -1 : c.offset().top }, this.renderBefore = function(g, f) { var j = this.ias, i = j.getFirstItem(), h = 0; j.fire("render", [g]), jQuery(g).hide(), i.before(g), jQuery(g).fadeIn(400, function() { ++h < g.length || (j.fire("rendered", [g]), f && f()) }) }, this }; IASHistoryExtension.prototype.initialize = function(d) { var c = this; this.ias = d, jQuery.extend(d.listeners, this.listeners), d.prev = function() { return c.prev() }, this.prevUrl = this.getPrevUrl() }, IASHistoryExtension.prototype.bind = function(b) { b.on("pageChange", jQuery.proxy(this.onPageChange, this)), b.on("scroll", jQuery.proxy(this.onScroll, this)), b.on("ready", jQuery.proxy(this.onReady, this)) }, IASHistoryExtension.prototype.unbind = function(b) { b.off("pageChange", this.onPageChange), b.off("scroll", this.onScroll), b.off("ready", this.onReady) }, IASHistoryExtension.prototype.prev = function() { var f = this.prevUrl, e = this, h = this.ias; if (!f) { return !1 } h.pause(); var g = h.fire("prev", [f]); return g.done(function() { h.load(f, function(b, c) { e.renderBefore(c, function() { e.prevUrl = e.getPrevUrl(b), h.resume(), e.prevUrl && e.prev() }) }) }), g.fail(function() { h.resume() }), !0 }, IASHistoryExtension.prototype.defaults = { prev: ".prev" }; var IASNoneLeftExtension = function(b) { return b = jQuery.extend({}, this.defaults, b), this.ias = null, this.uid = (new Date).getTime(), this.html = b.html.replace("{text}", b.text), this.showNoneLeft = function() { var d = jQuery(this.html).attr("id", "ias_noneleft_" + this.uid), c = this.ias.getLastItem(); c.after(d), d.fadeIn() }, this }; IASNoneLeftExtension.prototype.bind = function(b) { this.ias = b, b.on("noneLeft", jQuery.proxy(this.showNoneLeft, this)) }, IASNoneLeftExtension.prototype.unbind = function(b) { b.off("noneLeft", this.showNoneLeft) }, IASNoneLeftExtension.prototype.defaults = { text: "You reached the end.", html: '