1var __pager = { 2 3 autoload_count: 0, 4 5 init: function () { 6 __app.log('__pager init()'); 7 8 var $autoload_pagination = $('.js-pagination-autoload'); 9 10 if ($autoload_pagination.length) { 11 $(window).scroll(function () { 12 13 if ($('.js-pagination-autoload').length) { 14 var 15 height = $(window).height(), 16 scrolled = $(window).scrollTop(), 17 window_top = scrolled, 18 window_bottom = scrolled + height, 19 $pagination = $('.js-pagination-autoload'), 20 $load_button = $pagination.find('.js-pager'), 21 autoload_count = $load_button.attr('data-autoload-count') ?? false, 22 this_top = $pagination.offset().top, 23 this_height = $pagination.height(), 24 this_bottom = this_top + this_height, 25 is_in_window = (this_top >= window_top && this_top <= window_bottom) || (this_bottom >= window_top && this_bottom <= window_bottom); 26 27 if (is_in_window) { 28 $pagination.removeClass('js-pagination-autoload'); 29 if(!autoload_count || (autoload_count && __pager.autoload_count < autoload_count)) $load_button.click(); 30 } 31 } 32 }); 33 34 } 35 36 $(document).on('click', '.js-pager', function () { 37 38 $(this).addClass('loading').html('<div class="dot-flashing"></div>'); 39 40 var url = $(this).attr('data-url'); 41 42 $('BODY').append('<div class="hide" id="bg-pager-container"></div>'); 43 44 var 45 $pagerContainer = $('#bg-pager-container'), 46 $currentPager = $('.pagination'); 47 48 $pagerContainer.load(url + ' .js-items-wrapper', function (data) { 49 var 50 $newItems = $pagerContainer.find('.js-item'), 51 $newPager = $pagerContainer.find('.pagination'); 52 53 $currentPager.remove(); 54 $pagerContainer.remove(); 55 $newPager.remove(); 56 57 $('.js-items-wrapper .js-items').append($newItems); 58 $('.js-items-wrapper').append($newPager); 59 60 __catalog.init(); 61 __lazy_load_product.load_list_items(); 62 63 __pager.autoload_count++; 64 }); 65 66 }); 67 }, 68}; 69$(document).ready(function () { 70 __pager.init(); 71});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.