1jQuery(document).ready( function($) { 2 3 /** 4 * Settings 5 */ 6 window.googletag = window.googletag || {cmd: []}; 7 var windowHeight = (typeof window.outerHeight !== "undefined") ? Math.max(window.outerHeight, $(window).height()) : $(window).height(), 8 fired = false, 9 articles = 0; 10 11 function getDistFromBottom () { 12 var scrollPosition = window.pageYOffset; 13 var windowSize = window.innerHeight; 14 var $whitepapers = $('.container__promoted-whitepapers'); 15 if (!$whitepapers.length) return Infinity; 16 var wpOffset = $whitepapers.offset(); 17 if (!wpOffset) return Infinity; 18 var bodyHeight = wpOffset.top - 500; 19 return Math.max(bodyHeight - (scrollPosition + windowSize), 0); 20 } 21 22 function mkto_page_view(permalink){ 23 if (typeof Munchkin !== 'undefined' && Munchkin.munchkinFunction) { 24 Munchkin.munchkinFunction('visitWebPage', { 25 'url': permalink 26 } 27 ); 28 } 29 } 30 31 function generate_sidebar_mpu(article_id) { 32 33 if (typeof $('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot1').data('google-query-id') == 'undefined') 34 { 35 googletag.cmd.push(function () { 36 var slot = googletag.defineSlot('/32611537/clickz.us', [300, 250]) 37 .setTargeting('test', 'infinitescroll') 38 .addService(googletag.pubads()); 39 40 var div = document.createElement('div'); 41 div.id = slot.getSlotElementId(); // auto-generated by GPT 42 $('[data-article-id="' + article_id + '"] .ad').append(div); 43 $('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot1').attr('data-google-query-id','rendered'); 44 // Call display() to register the slot as ready and fetch an ad. 45 googletag.pubads().refresh([slot]); 46 googletag.display(slot); 47 48 }); 49 } 50 51 if (typeof $('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot2').data('google-query-id') == 'undefined') 52 { 53 googletag.cmd.push(function () { 54 var slot2 = googletag.defineSlot('/32611537/clickz.us', [300, 250]) 55 .setTargeting('test', 'infinitescroll') 56 .addService(googletag.pubads()); 57 var div = document.createElement('div'); 58 div.id = slot2.getSlotElementId(); // auto-generated by GPT 59 $('[data-article-id="' + article_id + '"] .ad__sidebar-skyscraper').append(div); 60 $('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot2').attr('data-google-query-id','rendered'); 61 googletag.pubads().refresh([slot2]); 62 googletag.display(slot2); 63 }); 64 } 65 66 //if($('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot1').data('google-query-id') !== 'undefined') 67 //{ 68 // // Define the slot itself, register it and fetch an ad. 69 // googletag.cmd.push(function() { 70 // var slot = googletag.defineSlot('/32611537/clickz.us', [300,250]) 71 // .addService(googletag.pubads()); 72 // 73 // var div = document.createElement('div'); 74 // div.id = slot.getSlotElementId(); // auto-generated by GPT 75 // $('[data-article-id="' + article_id + '"] .ad').html(div); 76 // 77 // // Call display() to register the slot as ready and fetch an ad. 78 // googletag.display(slot); 79 // }); 80 //} 81 // 82 //if(!$('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot2').hasClass('rendered') || typeof $('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot2').data('data-google-query-id') == 'undefined') 83 //{ 84 // // Define the slot itself, register it and fetch an ad. 85 // googletag.cmd.push(function() { 86 // var slot2 = googletag.defineSlot('/32611537/clickz.us', [300,250]) 87 // .setTargeting('test', 'rhc-mpu-ad-slot2') 88 // .addService(googletag.pubads()); 89 // 90 // var div = document.createElement('div'); 91 // div.id = slot2.getSlotElementId(); // auto-generated by GPT 92 // $('[data-article-id="' + article_id + '"] #rhc-mpu-ad-slot2').html(div).addClass('rendered'); 93 // 94 // // Call display() to register the slot as ready and fetch an ad. 95 // googletag.display(slot2); 96 // }); 97 //} 98 } 99 100 function pageView(value){ 101 var permalink = $(value).data('article-url'); 102 var article_id = $(value).data('article-id'); 103 var title = $(value).find('h1[itemprop="headline"]').text(); 104 var prev_url = document.URL; 105 history.replaceState({}, permalink, permalink) 106 document.title = title; 107 if(prev_url != permalink){ 108 history.pushState({}, permalink, permalink) 109 generate_sidebar_mpu(article_id); 110 mkto_page_view(permalink); 111 } 112 prev_url = permalink; 113 } 114 /** 115 * scroll 116 */ 117 var lastScroll = 0, 118 currentScroll; 119 $(window).scroll(function() { 120 121 window.clearTimeout($.data("this", "scrollTimer")); 122 $.data(this, "scrollTimer", window.setTimeout(function() { 123 124 currentScroll = $(window).scrollTop(); 125 126 if (currentScroll > lastScroll) { 127 $('[data-article-url]').each(function(key, value) { 128 var off = $(value).offset(); 129 if (!off) return true; 130 if (off.top + $(value).height() > currentScroll) { 131 pageView(value); 132 return false;
133 } 134 }); 135 } else if (currentScroll < lastScroll) { 136 $('[data-article-url]').each(function(key, value) { 137 var off = $(value).offset(); 138 if (!off) return true; 139 if (off.top + $(value).height() - windowHeight / 2 > currentScroll) { 140 pageView(value); 141 return false; 142 } 143 }); 144 } 145 146 lastScroll = currentScroll; 147 148 if(getDistFromBottom() <= 0 && fired == false && articles <= 9){ 149 150 fired = true; 151 jQuery.ajax({ 152 type : "post", 153 url : myAjax.ajaxurl, 154 data : {action: "fetch_next_article", post_id : post_ids[articles], scroll_nonce: myAjax.scroll_nonce}, 155 success: function (data, textStatus, request) { 156 var fetched_article = $(data).wrap('<div class="container__promoted-whitepapers"></div>'); 157 $(fetched_article).insertBefore(".container__promoted-whitepapers"); 158 articles++; 159 fired = false; 160 161 if(getDistFromBottom() == 0){ 162 var latest = $('[data-adslot="header-ad-slot"]').last(); 163 if (latest.length) { 164 var latestOff = $(latest).offset(); 165 if (latestOff) { 166 $('html, body').scrollTop( latestOff.top - $('.nav').height() - 50 ); 167 } 168 } 169 } 170 171 }, 172 }); 173 174 } 175 176 }, 250)); 177 178 }); 179 180});
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.