1jQuery(document).ready(function($) { 2 aTheme.WC.archive = { 3 loadMoreProducts: () => { 4 $('body').on('click', '.js-load-more-archive-products', function(e) { 5 e.preventDefault(); 6 7 if (aTheme.app.isDisabled($(this))) { 8 return false; 9 } 10 11 const $this = $(this); 12 const nextPageUrl = $this.attr('href'); 13 14 $.ajax({ 15 type: 'GET', 16 url: nextPageUrl, 17 beforeSend: function () { 18 $this.addClass('is-loading'); 19 }, 20 complete: function () { 21 $this.removeClass('is-loading'); 22 }, 23 success: function (response) { 24 const $html = $($.parseHTML(response)); 25 26 $('#js-archive-products-products').children().append($html.find('#js-archive-products-products').children().html()); 27 $('#js-archive-products-pagination').html($html.find('#js-archive-products-pagination').html()); 28 aTheme.loadLazyImages(); 29 history.pushState({}, null, nextPageUrl); 30 document.title = $html.filter('title').text(); 31 aTheme.WC.archive.updateProductCount(); 32 } 33 }); 34 }); 35 }, 36 updateProductCount: () => { 37 const $current = $('#js-product-archive-pagination-current'); 38 const $progress = $('#js-product-archive-pagination-progress'); 39 const $products = $('#js-archive-products-products'); 40 const count = $products.find('article').length; 41 const total = $current.attr('data-total'); 42 const percentage = (count / total) * 100; 43 44 $current.text(count); 45 46 if (parseInt(count) == parseInt(total)) { 47 $('#js-product-archive-pagination-percentage').hide(); 48 } 49 else { 50 $progress.css({ 51 'width': percentage + '%' 52 }); 53 } 54 }, 55 mobileFilter: () => { 56 var shopFilter = new hcSticky('.js-shop-filter:not(.is-relative-force)', { 57 disable: true, 58 responsive: { 59 991: { 60 disable: false, 61 stickTo: '.t-archive-product__main', 62 bottomEnd: -$('.js-shop-filter').innerHeight(), 63 innerTop: -50, 64 } 65 } 66 }); 67 68 $('.js-toggle-mobile-filter').on('click', function(e) { 69 const $this = $(this); 70 const shopFilterElement = document.querySelector('.js-shop-filter'); 71 $('.js-shop-filter').toggleClass('is-relative-force'); 72 73 if ($('.js-shop-filter').hasClass('is-relative-force')) { 74 shopFilter.destroy(); 75 76 if (shopFilterElement) { 77 shopFilterElement.scrollIntoView({ behavior: 'smooth' }); 78 } 79 } 80 else { 81 shopFilter.refresh(); 82 } 83 84 $('.js-mobile-filters').slideToggle(); 85 }); 86 }, 87 init: () => { 88 aTheme.WC.archive.loadMoreProducts(); 89 aTheme.WC.archive.updateProductCount(); 90 aTheme.WC.archive.mobileFilter(); 91 } 92 } 93 94 aTheme.WC.archive.init(); 95});
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.