Update template.ejs

This commit is contained in:
bihlink 2022-07-05 23:00:38 +02:00 committed by GitHub
parent 744a4b20b0
commit 758091e72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 0 deletions

View File

@ -91,6 +91,39 @@
</div>
</div><!-- container -->
<% if ( isIndex ){ %>
<script src="/infinite-scroll.js"></script>
<script type="text/javascript">
var lastPageLoaded = null;
var infScroll = new InfiniteScroll( '.container', {
// options
hideNav:'.pagination',
append: '.item',
history:false,
prefill:true,
path: function(){
// need to query this DOM my damn self
var pageLinks = document.querySelectorAll('.hacky_link');
if (!pageLinks || pageLinks.length == 0){
console.log ('next page link could not be found');
return false;
}else{
var finalLink = pageLinks[pageLinks.length-1].href;
// make sure we don't load the same page twice
if (!finalLink || finalLink == window.location.href || finalLink == lastPageLoaded){
console.log('this was the last page');
return false;
}else{
return finalLink;
}
}
}
});
</script>
<% } %>
<% } else { %>
<!-- Old theme -->