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