1jQuery(function($) { 2 3 "use strict"; 4 5 var pagination_type = getbowtied_scripts_vars.shop_pagination_type; 6 var load_more_text = getbowtied_scripts_vars.ajax_load_more_locale; 7 var load_more_loading_text = getbowtied_scripts_vars.ajax_loading_locale; 8 var no_more_items_text = getbowtied_scripts_vars.ajax_no_more_items_locale; 9 10 if ( pagination_type == 'load_more_button' || pagination_type == 'infinite_scroll' ) { 11 12 if ( $( '.woocommerce-pagination' ).length && $( 'body' ).hasClass( 'archive' ) ) { 13 14 $( '.woocommerce-pagination' ).before( '<div class="getbowtied_ajax_load_button"><a getbowtied_ajax_load_more_processing="0">' + load_more_text + '</a></div>' ); 15 16 if ( pagination_type == 'infinite_scroll' ) { 17 $( '.getbowtied_ajax_load_button' ).addClass( 'getbowtied_ajax_load_more_hidden' ); 18 } 19 20 if ( $('.woocommerce-pagination a.next').length == 0 ) { 21 $('.getbowtied_ajax_load_button').addClass( 'getbowtied_ajax_load_more_hidden' ); 22 } 23 24 $('.woocommerce-pagination').hide(); 25 } 26 27 $( 'body' ).on( 'click', '.getbowtied_ajax_load_button a', function(e) { 28 29 e.preventDefault(); 30 31 if ( $('.woocommerce-pagination a.next').length ) { 32 33 $( '.getbowtied_ajax_load_button a' ).attr( 'getbowtied_ajax_load_more_processing', 1 ); 34 var href = $( '.woocommerce-pagination a.next' ).attr( 'href' ); 35 36 $( '.getbowtied_ajax_load_button' ).fadeOut( 200, function() { 37 $( '.woocommerce-pagination' ).before( '<div class="getbowtied_ajax_load_more_loader"><span>' + load_more_loading_text + '</span></div>' ); 38 }); 39 40 $.get(href, function(response) { 41 42 $( '.woocommerce-pagination' ).html( $(response).find( '.woocommerce-pagination' ).html() ); 43 44 var i= 0; 45 46 $( response ).find( '.site-content ul.products > li' ).each( function() { 47 48 i++; 49 $(this).addClass( "ajax-loaded delay-" + i ); 50 $('.site-content ul.products > li:last').after($(this)); 51 }); 52 53 $('.getbowtied_ajax_load_more_loader').fadeOut(200, function(){ 54 $('.getbowtied_ajax_load_button').fadeIn(200); 55 $('.getbowtied_ajax_load_button a').attr('getbowtied_ajax_load_more_processing', 0); 56 }); 57 58 setTimeout(function(){ 59 $('.getbowtied_ajax_load_more_loader').remove(); 60 }, 250 ); 61 62 $(document).trigger('post-load'); 63 64 setTimeout(function(){ 65 66 $('.site-content ul.products > li').each( function(){ 67 //lazy loading tweak 68 var image = $(this).find('.product_thumbnail > img.jetpack-lazy-image'); 69 if( image ) { 70 if( image.attr('data-lazy-srcset') ) { 71 image.attr('srcset', image.attr('data-lazy-srcset')); 72 } else { 73 image.attr('srcset', image.attr('src')); 74 } 75 } 76 }); 77 78 $('.site-content ul.products > li.hidden').removeClass('hidden').addClass('animate'); 79 }, 500); 80 81 if ($('.woocommerce-pagination a.next').length == 0) { 82 $('.getbowtied_ajax_load_button').addClass('finished').removeClass('getbowtied_ajax_load_more_hidden'); 83 $('.getbowtied_ajax_load_button a').show().html(no_more_items_text).addClass('disabled'); 84 } 85 86 }); 87 88 } else { 89 90 $('.getbowtied_ajax_load_button').addClass('finished').removeClass('getbowtied_ajax_load_more_hidden'); 91 $('.getbowtied_ajax_load_button a').show().html(no_more_items_text).addClass('disabled'); 92 } 93 }); 94 } 95 96 if( pagination_type == 'infinite_scroll' ) { 97 98 var buffer_pixels = Math.abs(0); 99 100 $(window).on( 'scroll', function() { 101 102 if ($('.site-content ul.products:not(.product-categories)').length) { 103 104 var a = $('.site-content ul.products:not(.product-categories)').offset().top + $('.site-content ul.products:not(.product-categories)').outerHeight(); 105 var b = a - $(window).scrollTop(); 106 107 if ((b - buffer_pixels) < $(window).height()) { 108 if ($('.getbowtied_ajax_load_button a').attr('getbowtied_ajax_load_more_processing') == 0) { 109 $('.getbowtied_ajax_load_button a').trigger('click'); 110 } 111 } 112 113 } 114 115 }); 116 } 117 118 $('section.related.products').addClass('mobile-columns-' + getbowtied_scripts_vars.mobile_product_columns ); 119 $('section.upsells.products').addClass('mobile-columns-' + getbowtied_scripts_vars.mobile_product_columns ); 120});
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.