2 lines
1.1 KiB
JavaScript
2 lines
1.1 KiB
JavaScript
$(function(i){var t=1,o=window.location.pathname,r=i(document),a=i(".gh-postfeed"),s=300,c=!1,l=!1,w=window.scrollY,d=window.innerHeight,v=r.height();function u(){w=window.scrollY,e()}function f(){d=window.innerHeight,v=r.height(),e()}function e(){c||requestAnimationFrame(n),c=!0}function n(){var e;if(e=/(?:page\/)(\d)(?:\/)$/i,(n=(n=o).replace(/#(.*)$/g,"").replace("////g","/")).match(e)&&(t=parseInt(n.match(e)[1]),n=n.replace(e,"")),o=n,!l)if(w+d<=v-s)c=!1;else{if(t>=maxPages)return window.removeEventListener("scroll",u,{passive:!0}),void window.removeEventListener("resize",f);l=!0;var n=o+"page/"+(t+=1)+"/";i.get(n,function(e){e=document.createRange().createContextualFragment(e).querySelectorAll(".post");e.length&&[].forEach.call(e,function(e){a[0].appendChild(e)})}).fail(function(e){404===e.status&&(window.removeEventListener("scroll",u,{passive:!0}),window.removeEventListener("resize",f))}).always(function(){v=r.height(),c=l=!1})}}window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",f),n()});
|
|
//# sourceMappingURL=infinitescroll.js.map
|