diff --git a/cps/static/css/caliBlur.css b/cps/static/css/caliBlur.css index 92cf466e..490f652f 100644 --- a/cps/static/css/caliBlur.css +++ b/cps/static/css/caliBlur.css @@ -637,18 +637,18 @@ div[aria-label="Edit/Delete book"] > .btn > span:hover { color: var(--color-primary) } -.book { +/* .book { width: 225px; max-width: 225px; position: relative !important; - left: auto !important; + left: auto !important; top: auto !important; -webkit-transform: none !important; -ms-transform: none !important; transform: none !important; min-width: 225px; display: block -} +} */ #infscr-loading img, body > div.container-fluid > div > div.col-sm-10 > div.discover > div.isotope:after, body > div.container-fluid > div > div.col-sm-10 > div.discover > div.isotope:before { display: none diff --git a/cps/static/js/main.js b/cps/static/js/main.js index 7312f08d..f2d7b929 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -172,20 +172,36 @@ $(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 ); - }); + if ($(".load-more").length && $(".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 ) { + if ($("body").hasClass("blur")) { + $(".pagination").addClass("hidden").html(() => $(response).find(".pagination").html()); + } + $(".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")); + } + }); + } + } $("#restart").click(function() { $.ajax({ diff --git a/cps/templates/layout.html b/cps/templates/layout.html index c555f556..65867fe7 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -166,7 +166,7 @@ {% endif %} {% endfor %} {% if pagination.has_next %} -
  • {% endif %}