1/* global flatsome_infinite_scroll, Packery, ga */ 2 3;(function ($) { 4 $.fn.flatsomeInfiniteScroll = function () { 5 return this.each(function () { 6 var $container = jQuery('.shop-container .products') 7 var paginationNext = '.woocommerce-pagination li a.next' 8 9 if ($container.length === 0 || 10 jQuery(paginationNext).length === 0 || 11 $container.hasClass('ux-infinite-scroll-js-attached')) { 12 return 13 } 14 15 var viewMoreButton = jQuery('button.view-more-button.products-archive') 16 var byButton = flatsome_infinite_scroll.type === 'button' 17 var isMasonry = flatsome_infinite_scroll.list_style === 'masonry' 18 // Set packery instance as outlayer when masonry is set. 19 var outlayer = isMasonry ? Packery.data($container[0]) : false 20 21 var $infiScrollContainer = $container.infiniteScroll({ 22 path: paginationNext, 23 append: '.shop-container .product', 24 checkLastPage: true, 25 status: '.page-load-status', 26 hideNav: '.archive .woocommerce-pagination', 27 button: '.view-more-button', 28 history: flatsome_infinite_scroll.history, 29 historyTitle: true, 30 debug: false, 31 outlayer: outlayer, 32 scrollThreshold: parseInt(flatsome_infinite_scroll.scroll_threshold) 33 }) 34 35 if (byButton) { 36 viewMoreButton.removeClass('hidden') 37 $infiScrollContainer.infiniteScroll('option', { 38 scrollThreshold: false, 39 loadOnScroll: false 40 }) 41 } 42 43 $infiScrollContainer.on('load.infiniteScroll', function (event, response, path) { 44 flatsomeInfiniteScroll.attachBehaviors(response) 45 }) 46 47 $infiScrollContainer.on('request.infiniteScroll', function (event, path) { 48 if (byButton) viewMoreButton.addClass('loading') 49 }) 50 51 $infiScrollContainer.on('append.infiniteScroll', function (event, response, path, items) { 52 jQuery(document).trigger('flatsome-infiniteScroll-append', [response, path, items]) 53 if (byButton) viewMoreButton.removeClass('loading') 54 55 // Fix Safari bug 56 jQuery(items).find('img').each(function (index, img) { 57 img.outerHTML = img.outerHTML 58 }) 59 60 // Load fragments and init_handling_after_ajax for new items. 61 jQuery(document).trigger('yith_wcwl_reload_fragments') 62 jQuery(document).trigger('flatsome-equalize-box') 63 64 Flatsome.attach('lazy-load-images', $container) 65 flatsomeInfiniteScroll.animateNewItems(items) 66 67 if (isMasonry) { 68 setTimeout(function () { 69 $infiScrollContainer.imagesLoaded(function () { 70 $infiScrollContainer.packery('layout') 71 }) 72 }, 500) 73 } 74 75 if (window.ga && ga.loaded && typeof ga === 'function') { 76 var link = document.createElement('a') 77 link.href = path 78 ga('set', 'page', link.pathname) 79 ga('send', 'pageview') 80 } 81 }) 82 83 var flatsomeInfiniteScroll = { 84 attachBehaviors: function (response) { 85 Flatsome.attach('quick-view', response) 86 Flatsome.attach('tooltips', response) 87 Flatsome.attach('add-qty', response) 88 Flatsome.attach('wishlist', response) 89 }, 90 animateNewItems: function (items) { 91 if (isMasonry) return 92 jQuery(items).hide().fadeIn(parseInt(flatsome_infinite_scroll.fade_in_duration)) 93 } 94 } 95 96 // Initialize completed. 97 $container.addClass('ux-infinite-scroll-js-attached') 98 }) 99 } 100 101 // Doc ready. 102 $(function () { 103 $(document.body).flatsomeInfiniteScroll() 104 105 $(document).on('facetwp-loaded yith-wcan-ajax-filtered experimental-flatsome-pjax-request-done', function () { 106 $(document.body).flatsomeInfiniteScroll() 107 }) 108 }) 109})(jQuery)
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.