!function(b,c,d,e){XF.ScrollPaginator=XF.Element.newHandler({options:{appendTarget:"",considerFooter:!1,historyPush:!0,scrollPercent:100,triggerWindowResize:!1},loading:!1,init:function(){this.$pageNav=this.$target.find(".pageNav").first();this.$pageNav.length&&(this.options.considerFooter&&(this.$footer=b("#footer")),this.$append=this.$target.find(this.options.appendTarget),this.detectPageParams(),b(c).on("scroll",XF.proxy(this,"onScroll")),this.onScroll())},currentPage:0,lastPage:0,detectPageParams:function(){this.currentPage= parseInt(this.$pageNav.find(".pageNav-page--current").find("a").text(),10);this.lastPage=parseInt(this.$pageNav.find(".pageNav-page").last().find("a").text(),10)},onScroll:function(){this.isBottom()&&!this.isLastPage()&&this.load()},load:function(){this.loading||(this.loading=!0,this.sendRequest(this.$pageNav.find(".pageNav-page--current").next().find("a").attr("href")))},requestUrl:"",sendRequest:function(a){this.requestUrl=a;XF.ajax("GET",a,{},XF.proxy(this,"appendHtml"))},appendHtml:function(a){a.html&& a.html.content&&(a=b(a.html.content),this.$pageNav.html(a.find(".pageNav").first().html()),this.detectPageParams(),XF.activate(b(a.find(this.options.appendTarget).html()).appendTo(this.$append)),this.options.historyPush&&e.pushState({},d.title,this.requestUrl),this.options.triggerWindowResize&&b(c).trigger("resize"),this.loading=!1)},isBottom:function(){var a=b(d).height()-1;!this.options.considerFooter&&this.$footer.length&&(a-=this.$footer.outerHeight());return b(c).scrollTop()+b(c).height()>=a/ 100*this.options.scrollPercent},isLastPage:function(){return this.currentPage===this.lastPage}});XF.Element.register("scroll-paginator","XF.ScrollPaginator")}(window.jQuery,window,document,window.history);