From f574f8faf00342da222f38040a94e59d8764aa5a Mon Sep 17 00:00:00 2001 From: Ghighi Eftimie Date: Sat, 10 Oct 2020 18:34:55 +0300 Subject: [PATCH] better js check --- cps/static/js/main.js | 51 ++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/cps/static/js/main.js b/cps/static/js/main.js index c04ec65e..ff9cac08 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -172,32 +172,33 @@ $(function() { layoutMode : "fitColumns" }); - - var $loadMore = $(".load-more .row").infiniteScroll({ - debug: false, - // selector for the paged navigation (it will be hidden) - path : ".next", - // selector for the NEXT link (to page 2) - append : ".load-more .book" - //animate : true, # ToDo: Reenable function - //extraScrollPx: 300 - }); - $loadMore.on( "append.infiniteScroll", function( event, response, path, data ) { - $(".pagination").addClass("hidden"); - $(".load-more .row").isotope( "appended", $(data), null ); - }); - - // fix for infinite scroll on CaliBlur Theme (#981) - if ($(".load-more .row").length && $("body").hasClass("blur")) { - $(".col-sm-10").bind("scroll", function () { - if ( - $(this).scrollTop() + $(this).innerHeight() >= - $(this)[0].scrollHeight - ) { - $loadMore.infiniteScroll("loadNextPage"); - window.history.replaceState({}, null, $loadMore.infiniteScroll('getAbsolutePath')+1) - } + if ($('.next').length) { + var $loadMore = $(".load-more .row").infiniteScroll({ + debug: false, + // selector for the paged navigation (it will be hidden) + path : ".next", + // selector for the NEXT link (to page 2) + append : ".load-more .book" + //animate : true, # ToDo: Reenable function + //extraScrollPx: 300 }); + $loadMore.on( "append.infiniteScroll", function( event, response, path, data ) { + $(".pagination").addClass("hidden"); + $(".load-more .row").isotope( "appended", $(data), null ); + }); + + // fix for infinite scroll on CaliBlur Theme (#981) + if ($("body").hasClass("blur")) { + $(".col-sm-10").bind("scroll", function () { + if ( + $(this).scrollTop() + $(this).innerHeight() >= + $(this)[0].scrollHeight + ) { + $loadMore.infiniteScroll("loadNextPage"); + window.history.replaceState({}, null, $loadMore.infiniteScroll('getAbsolutePath')+1) + } + }); + } } $("#restart").click(function() {