!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(c,d){"use strict";c.infinitescroll=function(e,t,i){this.element=c(i),this._create(e,t)||(this.failed=!0)},c.infinitescroll.defaults={loading:{finished:d,finishedMsg:"Congratulations, you've reached the end of the internet.",img:"",msg:null,msgText:"Loading the next set of posts...",selector:null,speed:"fast",start:d},state:{isDuringAjax:!1,isInvalidPage:!1,isDestroyed:!1,isDone:!1,isPaused:!1,isBeyondMaxPage:!1,currPage:1},debug:!1,behavior:d,binder:c(window),nextSelector:"div.navigation a:first",navSelector:"div.navigation",contentSelector:null,extraScrollPx:150,itemSelector:"div.post",animate:!1,pathParse:d,dataType:"html",appendCallback:!0,bufferPx:40,errorCallback:function(){},infid:0,pixelsFromNavToBottom:d,path:d,prefill:!1,maxPage:d},c.infinitescroll.prototype={_binding:function(e){var t=this,i=t.options;if(i.v="2.0b2.120520",i.behavior&&this["_binding_"+i.behavior]!==d)this["_binding_"+i.behavior].call(this);else{if("bind"!==e&&"unbind"!==e)return this._debug("Binding value "+e+" not valid"),!1;"unbind"===e?this.options.binder.unbind("smartscroll.infscr."+t.options.infid):this.options.binder[e]("smartscroll.infscr."+t.options.infid,function(){t.scroll()}),this._debug("Binding",e)}},_create:function(e,n){var o=c.extend(!0,{},c.infinitescroll.defaults,e);this.options=o;var a=c(window);if(!this._validate(e))return!1;var t=c(o.nextSelector).attr("href");if(!t)return this._debug("Navigation selector not found"),!1;o.path=o.path||this._determinepath(t),o.contentSelector=o.contentSelector||this.element,o.loading.selector=o.loading.selector||o.contentSelector,o.loading.msg=o.loading.msg||c('
Loading...
'+o.loading.msgText+"
"),(new Image).src=o.loading.img,o.pixelsFromNavToBottom===d&&(o.pixelsFromNavToBottom=c(document).height()-c(o.navSelector).offset().top,this._debug("pixelsFromNavToBottom: "+o.pixelsFromNavToBottom));var i=this;return o.loading.start=o.loading.start||function(){c(o.navSelector).hide(),o.loading.msg.appendTo(o.loading.selector).show(o.loading.speed,c.proxy(function(){this.beginAjax(o)},i))},o.loading.finished=o.loading.finished||function(){o.state.isBeyondMaxPage||o.loading.msg.fadeOut(o.loading.speed)},o.callback=function(e,t,i){o.behavior&&e["_callback_"+o.behavior]!==d&&e["_callback_"+o.behavior].call(c(o.contentSelector)[0],t,i),n&&n.call(c(o.contentSelector)[0],t,o,i),o.prefill&&a.bind("resize.infinite-scroll",e._prefill)},e.debug&&(!Function.prototype.bind||"object"!=typeof console&&"function"!=typeof console||"object"!=typeof console.log||["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.call(console[e],console)},Function.prototype.bind)),this._setup(),o.prefill&&this._prefill(),!0},_prefill:function(){function e(){return c(t.options.contentSelector).height()<=i.height()}var t=this,i=c(window);this._prefill=function(){e()&&t.scroll(),i.bind("resize.infinite-scroll",function(){e()&&(i.unbind("resize.infinite-scroll"),t.scroll())})},this._prefill()},_debug:function(){!0===this.options.debug&&("undefined"!=typeof console&&"function"==typeof console.log?1===Array.prototype.slice.call(arguments).length&&"string"==typeof Array.prototype.slice.call(arguments)[0]?console.log(Array.prototype.slice.call(arguments).toString()):console.log(Array.prototype.slice.call(arguments)):Function.prototype.bind||"undefined"==typeof console||"object"!=typeof console.log||Function.prototype.call.call(console.log,console,Array.prototype.slice.call(arguments)))},_determinepath:function(e){var t=this.options;if(t.behavior&&this["_determinepath_"+t.behavior]!==d)return this["_determinepath_"+t.behavior].call(this,e);if(t.pathParse)return this._debug("pathParse manual"),t.pathParse(e,this.options.state.currPage+1);if(e.match(/^(.*?)\b2\b(.*?$)/))e=e.match(/^(.*?)\b2\b(.*?$)/).slice(1);else if(e.match(/^(.*?)2(.*?$)/)){if(e.match(/^(.*?page=)2(\/.*|$)/))return e=e.match(/^(.*?page=)2(\/.*|$)/).slice(1);e=e.match(/^(.*?)2(.*?$)/).slice(1)}else{if(e.match(/^(.*?page=)1(\/.*|$)/))return e=e.match(/^(.*?page=)1(\/.*|$)/).slice(1);this._debug("Sorry, we couldn't parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com."),t.state.isInvalidPage=!0}return this._debug("determinePath",e),e},_error:function(e){var t=this.options;t.behavior&&this["_error_"+t.behavior]!==d?this["_error_"+t.behavior].call(this,e):("destroy"!==e&&"end"!==e&&(e="unknown"),this._debug("Error",e),"end"!==e&&!t.state.isBeyondMaxPage||this._showdonemsg(),t.state.isDone=!0,t.state.currPage=1,t.state.isPaused=!1,t.state.isBeyondMaxPage=!1,this._binding("unbind"))},_loadcallback:function(e,t,i){var n,o=this.options,a=this.options.callback,s=o.state.isDone?"done":o.appendCallback?"append":"no-append";if(o.behavior&&this["_loadcallback_"+o.behavior]!==d)this["_loadcallback_"+o.behavior].call(this,e,t);else{switch(s){case"done":return this._showdonemsg(),!1;case"no-append":if("html"===o.dataType&&(t=c(t="
"+t+"
").find(o.itemSelector)),0===t.length)return this._error("end");break;case"append":var r=e.children();if(0===r.length)return this._error("end");for(n=document.createDocumentFragment();e[0].firstChild;)n.appendChild(e[0].firstChild);this._debug("contentSelector",c(o.contentSelector)[0]),c(o.contentSelector)[0].appendChild(n),t=r.get()}if(o.loading.finished.call(c(o.contentSelector)[0],o),o.animate){var l=c(window).scrollTop()+c(o.loading.msg).height()+o.extraScrollPx+"px";c("html,body").animate({scrollTop:l},800,function(){o.state.isDuringAjax=!1})}o.animate||(o.state.isDuringAjax=!1),a(this,t,i),o.prefill&&this._prefill()}},_nearbottom:function(){var e=this.options,t=0+c(document).height()-e.binder.scrollTop()-c(window).height();return e.behavior&&this["_nearbottom_"+e.behavior]!==d?this["_nearbottom_"+e.behavior].call(this):(this._debug("math:",t,e.pixelsFromNavToBottom),t-e.bufferPxo.maxPage)return o.state.isBeyondMaxPage=!0,void this.destroy();switch(a=c(o.contentSelector).is("table, tbody")?c(""):c("
"),s="function"==typeof t?t(o.state.currPage):t.join(o.state.currPage),l._debug("heading into ajax",s),e="html"===o.dataType||"json"===o.dataType?o.dataType:"html+callback",o.appendCallback&&"html"===o.dataType&&(e+="+callback"),e){case"html+callback":l._debug("Using HTML via .load() method"),a.load(s+" "+o.itemSelector,d,function(e){l._loadcallback(a,e,s)});break;case"html":l._debug("Using "+e.toUpperCase()+" via $.ajax() method"),c.ajax({url:s,dataType:o.dataType,complete:function(e,t){(r=void 0!==e.isResolved?e.isResolved():"success"===t||"notmodified"===t)?l._loadcallback(a,e.responseText,s):l._error("end")}});break;case"json":l._debug("Using "+e.toUpperCase()+" via $.ajax() method"),c.ajax({dataType:"json",type:"GET",url:s,success:function(e,t,i){if(r=void 0!==i.isResolved?i.isResolved():"success"===t||"notmodified"===t,o.appendCallback)if(o.template!==d){var n=o.template(e);a.append(n),r?l._loadcallback(a,n):l._error("end")}else l._debug("template must be defined."),l._error("end");else r?l._loadcallback(a,e,s):l._error("end")},error:function(){l._debug("JSON ajax request failed."),l._error("end")}})}},retrieve:function(e){e=e||null;var t=this.options;if(t.behavior&&this["retrieve_"+t.behavior]!==d)this["retrieve_"+t.behavior].call(this,e);else{if(t.state.isDestroyed)return this._debug("Instance is destroyed"),!1;t.state.isDuringAjax=!0,t.loading.start.call(c(t.contentSelector)[0],t)}},scroll:function(){var e=this.options,t=e.state;e.behavior&&this["scroll_"+e.behavior]!==d?this["scroll_"+e.behavior].call(this):t.isDuringAjax||t.isInvalidPage||t.isDone||t.isDestroyed||t.isPaused||this._nearbottom()&&this.retrieve()},toggle:function(){this._pausing()},unbind:function(){this._binding("unbind")},update:function(e){c.isPlainObject(e)&&(this.options=c.extend(!0,this.options,e))}},c.fn.infinitescroll=function(t,i){switch(typeof t){case"string":var n=Array.prototype.slice.call(arguments,1);this.each(function(){var e=c.data(this,"infinitescroll");return!!e&&(!(!c.isFunction(e[t])||"_"===t.charAt(0))&&void e[t].apply(e,n))});break;case"object":this.each(function(){var e=c.data(this,"infinitescroll");e?e.update(t):(e=new c.infinitescroll(t,i,this)).failed||c.data(this,"infinitescroll",e)})}return this};var o,e=c.event;e.special.smartscroll={setup:function(){c(this).bind("scroll",e.special.smartscroll.handler)},teardown:function(){c(this).unbind("scroll",e.special.smartscroll.handler)},handler:function(e,t){var i=this,n=arguments;e.type="smartscroll",o&&clearTimeout(o),o=setTimeout(function(){c(i).trigger("smartscroll",n)},"execAsap"===t?0:100)}},c.fn.smartscroll=function(e){return e?this.bind("smartscroll",e):this.trigger("smartscroll",["execAsap"])}}),function(s){t(),l(),c();var i=window.location.hash,n="^#p-[0-9]",r=!1;function t(){if(0!=s("#np-blog-pagination .page-numbers").length){var o=s("#np-blog-pagination .page-numbers").not(".next").last().attr("href").split("/").slice(0,-1).pop(),a={loading:{msgText:"Load next articles",finishedMsg:"All articles loaded"},nextSelector:"#np-blog-pagination .next",navSelector:"#np-blog-pagination",itemSelector:"li.hentry",contentSelector:"#article > .page-blog-list .list",extraScrollPx:0,animate:!1,bufferPx:1e3};jQuery(a.contentSelector).infinitescroll(a,function(e,t,i){l(),c();var n=i.split("/").slice(0,-1).pop();o==n&&(jQuery(a.contentSelector).infinitescroll("pause"),s("#article > .page-blog-list .loading").hide()),r||d()})}}function l(){s(".np_video a").magnificPopup({focus:"none",disableOn:700,type:"iframe",mainClass:"mfp-fade",preloader:!1}),s(".np_video").on("click",function(){o()})}function c(){s(".np_podcast").on("click",function(e){e.preventDefault(),s(this).addClass("np_podcast_play"),s(this).find("audio").each(function(){this.play()})}),s(".np_podcast audio").on("click",function(e){e.stopPropagation()})}function o(){s("audio").each(function(){this.pause()})}function d(){if(void 0!==i&&i.match(n))if(s(i).length){if(s(i).hasClass("np_video")){var e=s(i).find("a").attr("href");s.magnificPopup.open({focus:"none",items:{src:e},disableOn:700,type:"iframe",mainClass:"mfp-fade",preloader:!1,fixedContentPos:!0,iframe:{patterns:{youtube:{index:"youtube.com/",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=0"}}},callbacks:{close:function(){s(window).scrollTop(s(i).offset().top)}}})}else if(s(i).hasClass("np_podcast")){var t='
  • '+s(i).html()+"
";s.magnificPopup.open({focus:"none",items:{src:t},mainClass:"mfp-fade",preloader:!1,callbacks:{open:function(){c()},close:function(){s(window).scrollTop(s(i).offset().top),o()}}})}else s(window).scrollTop(s(i).offset().top);r=!0}else s("#article > .page-blog-list .list").infinitescroll("retrieve")}d(),s("#np-category-select").on("change",function(){var e=s(this).val();return s("#article > .page-blog-list .list").infinitescroll("destroy").remove(),s("#article > .page-blog-list .inner").load(e+" #np-load-area",function(){t(),l(),c()}),!1})}(jQuery),document.addEventListener("play",function(e){for(var t=document.getElementsByTagName("audio"),i=0,n=t.length;i