1(function($){ 2 3 // Infinite Scrolling Proccess based on waypoints infinite scrolling http://imakewebthings.com/waypoints/shortcuts/infinite-scroll/ 4 // Reads the next page of pagination and append items to container 5 6 var infiniteScroll = function(element,options){ 7 this.$wraper = $(element); 8 this.options = $.extend({}, this.defaults, options); 9 this.$element = this.$wraper.children(this.options.items); 10 this._init(); 11 12 }; 13 14 // items: matching elements 15 // more: the next page of pagination 16 // loadingMore: Loader 17 18 infiniteScroll.prototype = { 19 defaults:{ 20 items:'.infinite_item', 21 more:'a.next.page-numbers', 22 loadingMore: '.infinite-loading-more', 23 }, 24 _init:function(){ 25 var self = this; 26 27 if(LL.isLongReads && $(window).width() < 768){ 28 $(this.options.more).attr('href',$(this.options.more).attr('href') + '?is_mobile_request=true'); 29 } 30 31 this.infinite = new Waypoint.Infinite({ 32 element: self.$wraper['0'], 33 items: self.options.items, 34 more: self.options.more, 35 offset: function() { 36 // When to trigger the request 37 // see http://imakewebthings.com/waypoints/api/offset-option/ for more details about the offset 38 return !LL.isLongReads ? this.context.innerHeight() - this.adapter.outerHeight() + 500 : 'bottom-in-view'; 39 // return this.context.innerHeight() - this.adapter.outerHeight() + 500; 40 }, 41 onBeforePageLoad: function(){ 42 43 // Add loader on request 44 $(self.options.loadingMore).show(); 45 }, 46 onAfterPageLoad: function(items){ 47 // Remove loader after response and destroy instance if all items are loaded 48 $(self.options.loadingMore).hide(); 49 50 51 if(!items.length){ 52 self.destroy(); 53 return; 54 } 55 56 57 if(LL.isLongReads){ 58 59 items.each(function(i,e){ 60 var grid = document.querySelector('.columns_container'); 61 salvattore.appendElements(grid, [$(e)['0']]); 62 }) 63 } 64 65 66 67 // Add dfp banners after response 68 // The banners are created with data attrs: slot, sizes, mapping 69 // See template-parts/archives/infinite-scrolling-ads.php for more details 70 items.each(function(){ 71 $(this).find('.infinite-scolling__ads').each(function(){ 72 var code = 73 'googletag.cmd.push(function(){' + 74 'var index = gptAdSlots.length;' + 75 'gptAdSlots.push(googletag.defineSlot("' + $(this).data('slot') + '", [' + $(this).data('sizes') + '], "' + $(this).attr('id') + '")' + 76 '.defineSizeMapping(mappingSizes["' + $(this).data('mapping') +'"])' + 77 '.addService(googletag.pubads()));' + 78 79 // commented out after OCM request 80 // OCM lazyload & header bidding functions activated 81 // 'googletag.pubads().refresh([gptAdSlots[index]]);' + 82 '});'; 83 84 var script = document.createElement('script'); 85 script.innerHTML = code; 86 $(this).append(script); 87 88 }); 89 }); 90 91 }, 92 93 }); 94 95 96 }, 97 destroy:function(){ 98 // console.log('destroy'); 99 $.removeData( this, 'infiniteScroll' ); 100 this.infinite.destroy(); 101 }, 102 } 103 104 $.fn.infiniteScroll = function(options) { 105 var method,args; 106 // create an instance for each element in the set 107 if (typeof(options) == 'string') { 108 method = options; 109 args = Array.prototype.slice.call(arguments, 1); 110 } 111 // create an instance for each element in the set 112 this.each(function() { 113 var instance = $(this).data('infiniteScroll'); 114 if(instance){ 115 if (method) { 116 instance[method].apply(instance, args); 117 } 118 }else{ 119 var instance = new infiniteScroll(this,options); 120 $(this).data("infiniteScroll", instance); 121 } 122 123 }); 124 // Maintain jQuery chain 125 return this; 126 }; 127 128 129 130 131 132})(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.