1
2
|
/* Do not modify this file directly. It is compiled from other files. */
!function($){var Scroller,ajaxurl,stats,type,text,totop,isIE=-1!=navigator.userAgent.search("MSIE");if(isIE)var IEVersion=navigator.userAgent.match(/MSIE\s?(\d+)\.?\d*;/),IEVersion=parseInt(IEVersion[1]);function fullscreenState(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement?1:0}"https:"==document.location.protocol&&(infiniteScroll.settings.ajaxurl=infiniteScroll.settings.ajaxurl.replace("http://","https://")),Scroller=function(e){var t=this;this.id=e.id,this.body=$(document.body),this.window=$(window),this.element=$("#"+e.id),this.wrapperClass=e.wrapper_class,this.ready=!0,this.disabled=!1,this.page=1,this.offset=e.offset,this.currentday=e.currentday,this.order=e.order,this.throttle=!1,this.handle='<div id="infinite-handle"><span><button>'+text.replace("\\","")+"</button></span></div>",this.click_handle=e.click_handle,this.google_analytics=e.google_analytics,this.history=e.history,this.origURL=window.location.href,this.pageCache={},this.footer=$("#infinite-footer"),this.footer.wrap=e.footer,this.wpMediaelement=null,"scroll"==type?(this.window.bind("scroll.infinity",function(){this.throttle=!0}),t.gotop(),setInterval(function(){this.throttle&&(this.throttle=!1,t.thefooter(),t.refresh(),t.determineURL())},250),t.ensureFilledViewport(),this.body.bind("post-load",{self:t},t.checkViewportOnLoad)):"click"==type&&(this.click_handle&&this.element.append(this.handle),this.body.delegate("#infinite-handle","click.infinity",function(){t.click_handle&&$("#infinite-handle").remove(),t.refresh()})),this.body.bind("post-load",{self:t},t.initializeMejs)},Scroller.prototype.check=function(){var e=this.element.offset();return"object"==typeof e&&this.window.scrollTop()+this.window.height()>e.top+this.element.outerHeight(!1)-2*this.window.height()},Scroller.prototype.render=function(e){this.body.addClass("infinity-success"),this.element.append(e.html),this.body.trigger("post-load",e),this.ready=!0},Scroller.prototype.query=function(){return{page:this.page+this.offset,currentday:this.currentday,order:this.order,scripts:window.infiniteScroll.settings.scripts,styles:window.infiniteScroll.settings.styles,query_args:window.infiniteScroll.settings.query_args,query_before:window.infiniteScroll.settings.query_before,last_post_date:window.infiniteScroll.settings.last_post_date}},Scroller.prototype.gotop=function(){var e=$("#infinity-blog-title");e.attr("title",totop),e.bind("click",function(e){$("html, body").animate({scrollTop:0},"fast"),e.preventDefault()})},Scroller.prototype.thefooter=function(){var e;"string"===$.type(this.footer.wrap)&&(e=$("body #"+this.footer.wrap).outerWidth(!1))>479&&this.footer.find(".container").css("width",e),this.window.scrollTop()>=350?this.footer.animate({bottom:0},"fast"):this.window.scrollTop()<350&&this.footer.animate({bottom:"-50px"},"fast")},Scroller.prototype.refresh=function(){var self=this,query,jqxhr,load,loader,color,customized;if(!this.disabled&&this.ready&&this.check()){if(this.ready=!1,this.click_handle){loader='<span class="infinite-loader"></span>',this.element.append(loader),loader=this.element.find(".infinite-loader"),color=loader.css("color");try{loader.spin("medium-left",color)}catch(e){}}return query=$.extend({action:"infinite_scroll"},this.query()),"undefined"!=typeof wp&&wp.customize&&wp.customize.settings.theme&&(customized={},query.wp_customize="on",query.theme=wp.customize.settings.theme.stylesheet,wp.customize.each(function(e){e._dirty&&(customized[e.id]=e())}),query.customized=JSON.stringify(customized),query.nonce=wp.customize.settings.nonce.preview),jqxhr=$.post(infiniteScroll.settings.ajaxurl,query),jqxhr.fail(function(){self.click_handle&&loader.hide(),self.ready=!0}),jqxhr.done(function(response){if(self.click_handle&&loader.hide(),response&&response.type&&"success"==response.type&&(response.scripts&&$(response.scripts).each(function(){var e=this.footer?"body":"head";if(window.infiniteScroll.settings.scripts.push(this.handle),this.extra_data){var t=document.createElement("script"),i=document.createTextNode("//<![CDATA[ \n"+this.extra_data+"\n//]]>");t.type="text/javascript",t.appendChild(i),document.getElementsByTagName(e)[0].appendChild(t)}var s=document.createElement("script");s.type="text/javascript",s.src=this.src,s.id=this.handle,"wp-mediaelement"===this.handle&&self.body.unbind("post-load",self.initializeMejs),"wp-mediaelement"===this.handle&&"undefined"==typeof mejs?(self.wpMediaelement={},self.wpMediaelement.tag=s,self.wpMediaelement.element=e,setTimeout(self.maybeLoadMejs.bind(self),250)):document.getElementsByTagName(e)[0].appendChild(s)}),response.styles&&$(response.styles).each(function(){window.infiniteScroll.settings.styles.push(this.handle);var style=document.createElement("link");if(style.rel="stylesheet",style.href=this.src,style.id=this.handle+"-css",this.conditional&&(!isIE||!eval(this.conditional.replace(/%ver/g,IEVersion))))var style=!1;style&&document.getElementsByTagName("head")[0].appendChild(style)}),self.pageCache[self.page+self.offset]=response,self.page++,stats&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+stats+"&post=0&baba="+Math.random()),"object"==typeof response.postflair&&"object"==typeof WPCOM_sharing_counts&&(WPCOM_sharing_counts=$.extend(WPCOM_sharing_counts,response.postflair)),self.render.apply(self,arguments),"click"==type?response.lastbatch?self.click_handle?($("#infinite-handle").remove(),self.body.addClass("infinity-end").removeClass("infinity-success")):self.body.trigger("infinite-scroll-posts-end"):self.click_handle?self.element.append(self.handle):self.body.trigger("infinite-scroll-posts-more"):response.lastbatch&&(self.disabled=!0,self.body.addClass("infinity-end").removeClass("infinity-success")),response.currentday&&(self.currentday=response.currentday),self.google_analytics)){var ga_url=self.history.path.replace(/%d/,self.page);"object"==typeof _gaq&&_gaq.push(["_trackPageview",ga_url]),"function"==typeof ga&&ga("send","pageview",ga_url)}}),jqxhr}},Scroller.prototype.maybeLoadMejs=function(){null!==this.wpMediaelement&&("undefined"==typeof mejs?setTimeout(this.maybeLoadMejs,250):(document.getElementsByTagName(this.wpMediaelement.element)[0].appendChild(this.wpMediaelement.tag),this.wpMediaelement=null,this.body.bind("post-load",{self:this},this.initializeMejs)))},Scroller.prototype.initializeMejs=function(e,t){!t.html||-1===t.html.indexOf("wp-audio-shortcode")&&-1===t.html.indexOf("wp-video-shortcode")||"undefined"!=typeof mejs&&$(function(){var e={};"undefined"!=typeof _wpmejsSettings&&(e.pluginPath=_wpmejsSettings.pluginPath),e.success=function(e){var t=e.attributes.autoplay&&"false"!==e.attributes.autoplay;"flash"===e.pluginType&&t&&e.addEventListener("canplay",function(){e.play()},!1)},$(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(e)})},Scroller.prototype.ensureFilledViewport=function(){var e=this.window.height(),t=this.element.height(),i=0,s=0;0!==t||($(this.element.selector+" > li").each(function(){t+=$(this).height()}),0!==t)?($("."+this.wrapperClass).each(function(){i+=$(this).height(),s++}),s>0?i/=s:i=0,t<e&&t+i<e?(this.ready=!0,this.refresh()):this.body.unbind("post-load",this.checkViewportOnLoad)):this.body.unbind("post-load",this.checkViewportOnLoad)},Scroller.prototype.checkViewportOnLoad=function(e){e.data.self.ensureFilledViewport()};var previousFullScrenState=fullscreenState();Scroller.prototype.determineURL=function(){var e=this,t=$(window).scrollTop(),i=t+$(window).height(),s=i-t,o=[],n=[],l=!1,r=fullscreenState();if(previousFullScrenState^r)previousFullScrenState=r;else{if(previousFullScrenState=r,$("."+e.wrapperClass).each(function(){var e,s=$(this).attr("id"),l=$(this).offset().top,r=$(this).outerHeight(!1),a=$(this).data("page-num");0===r&&$("> *",this).each(function(){r+=$(this).outerHeight(!1)}),e=l+r,l<t&&e>i?o.push({id:s,top:l,bottom:e,pageNum:a}):l>t&&l<i?o.push({id:s,top:l,bottom:e,pageNum:a}):e>t&&e<i?o.push({id:s,top:l,bottom:e,pageNum:a}):n.push({id:s,top:l,bottom:e,pageNum:a})}),$.each(n,function(){var t=$("#"+this.id);t.hasClass("is--replaced")||(e.pageCache[this.pageNum].html=t.html(),t.css("min-height",this.bottom-this.top+"px").addClass("is--replaced").empty())}),$.each(o,function(){var t=$("#"+this.id);t.hasClass("is--replaced")&&(t.css("min-height","").removeClass("is--replaced"),this.pageNum in e.pageCache&&(t.html(e.pageCache[this.pageNum].html),e.body.trigger("post-load",e.pageCache[this.pageNum])))}),0==o.length)l=-1;else if(1==o.length){var a=o.pop();l=(i-a.top)/s<.5?-1:a.pageNum}else{var c=0;$.each(o,function(e,o){var n=0,r=0,a=0;o.top>t&&o.top<i&&(n=(i-o.top)/s),o.bottom>t&&o.bottom<i&&(r=(o.bottom-t)/s),n>=r?a=n:r>=n&&(a=r),a>c&&(l=o.pageNum,c=a)})}"number"==typeof l&&e.updateURL(l)}},Scroller.prototype.updateURL=function(e){if(window.history.pushState){var t=-1==e?this.origURL:window.location.protocol+"//"+this.history.host+this.history.path.replace(/%d/,e)+this.history.parameters;window.location.href!=t&&history.pushState(null,null,t)}},Scroller.prototype.pause=function(){this.disabled=!0},Scroller.prototype.resume=function(){this.disabled=!1},$(document).ready(function(){if("object"==typeof infiniteScroll){if($(document.body).addClass(infiniteScroll.settings.body_class),ajaxurl=infiniteScroll.settings.ajaxurl,stats=infiniteScroll.settings.stats,type=infiniteScroll.settings.type,text=infiniteScroll.settings.text,totop=infiniteScroll.settings.totop,infiniteScroll.scroller=new Scroller(infiniteScroll.settings),"click"==type){var e=null;$(window).bind("scroll",function(){e||(e=setTimeout(function(){infiniteScroll.scroller.determineURL(),e=null},250))})}"undefined"!=typeof wp&&wp.customize&&wp.customize.selectiveRefresh&&(wp.customize.selectiveRefresh.bind("partial-content-rendered",function(e){var t;"string"==typeof e.addedContent?t=e.addedContent:e.container&&(t=$(e.container).html()),t&&$(document.body).trigger("post-load",{html:t})}),"undefined"==typeof MutationObserver&&$(document.body).on("post-load",function(e,t){var i=null;t.html&&-1!==t.html.indexOf("data-customize-partial")&&(infiniteScroll.settings.id&&(i=$("#"+infiniteScroll.settings.id)),wp.customize.selectiveRefresh.addPartials(i))}))}})}(jQuery);
|