1var listing = { 2 currentPage : 1, 3 4 initialize : function(config) { 5 this.config = config; 6 this.loadMoreButton = $(this.config.button_selector); 7 this.loadMoreButton.click(this.loadMore.bind(this)); 8 }, 9 rebuild() { 10 this.currentPage = 1; 11 this.loadMoreButton = $(this.config.button_selector); 12 this.loadMoreButton.click(this.loadMore.bind(this)); 13 }, 14 loadMore : function() { 15 this.lastPage = this.loadMoreButton.data('last-page'); 16 $('.blog__load').addClass('loader'); 17 if(this.currentPage <= this.lastPage) { 18 $.ajax({ 19 'url' : this.getAjaxUrl(), 20 'success' : this.processAjaxResponse.bind(this), 21 }); 22 } 23 }, 24 getAjaxUrl : function() { 25 this.currentPage++; 26 let url = window.location.href; 27 let page = 'page/'; 28 if(window.location.search.length !== 0){ 29 url = window.location.origin; 30 page = '/page/'; 31 } 32 //url += (window.location.href.indexOf('?') == -1) ? '?' : '&'; 33 url += page + this.currentPage + window.location.search; 34 return url; 35 }, 36 processAjaxResponse : function(response) { 37 38 if(this.currentPage >= this.lastPage) { 39 this.loadMoreButton.hide(); 40 } 41 response = $(response); 42 $('.blog__load').removeClass('loader'); 43 $(this.config.listing_selector).append(response.find(this.config.listing_selector).html()); 44 // Banner hero shop widget 45 $('.js-shop-widget-slider-btn').on('click', function(e) { 46 $(this).next('.js-shop-widget-slider').toggleClass('active'); 47 $(this).closest('section').toggleClass('has-widget'); 48 e.stopPropagation(); 49 }); 50 51 $('.js-shop-widget-slider').click(function(e){ 52 e.stopPropagation(); 53 }); 54 55 $(document).click(function(){ 56 $('.js-shop-widget-slider').removeClass('active'); 57 $('section.has-widget').removeClass('has-widget'); 58 }); 59 60 $('.js-shop-widget-slider-close').on('click', function() { 61 $('.js-shop-widget-slider').removeClass('active'); 62 $('section.has-widget').removeClass('has-widget'); 63 }); 64 }, 65}; 66jQuery(function() { 67 listing.initialize({ 68 'listing_selector' : '#listing', 69 'button_selector' : '#load-more' 70 }); 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.