1jQuery(document).ready(function($) { 2 3 $('iframe[src*="youtube.com"]').each(function() { 4 var url = $(this).attr("src"); 5 $(this).attr("src",url+"&wmode=transparent"); 6 $(this).parent().addClass( "video-container" ); 7 }); 8 9 // function ads () { 10 11 // console.log("ads"); 12 13 // jQuery('.adunit:not(".display-block")').dfp({ 14 15 // dfpID: '416718644', 16 17 // enableSingleRequest: false 18 19 // }); 20 21 // } 22 23 // ads(); 24 25 //ajaxInitEmbeds(); 26 27 var scrollTracker = 1; 28 var loadTriggerOffset = 3000; 29 var checkForLoad = true; 30 var articles = []; 31 var currentArticleIndex = 0; 32 33 function addArticleToCache(container) { 34 35 var id = container.attr('ta_post_id'); 36 37 var header = $('.bg_' + id); 38 39 if (typeof header.offset() != 'undefined') { 40 41 articles.push({ 42 43 offset: header.offset().top, 44 url: container.attr('ta_post_url'), 45 title: container.attr('ta_post_title') 46 47 }); 48 49 } 50 51 } 52 53 54 function OnScroll() { 55 56 if (history.replaceState) { 57 58 var scrollTop = $(window).scrollTop(); 59 60 for (var i = articles.length - 1; i >= 0; i--) { 61 62 if (scrollTop >= articles[i].offset) { 63 64 if (currentArticleIndex !== i) { 65 66 currentArticleIndex = i; 67 68 history.replaceState(null, null, 69 window.location.protocol + '//' + window.location.hostname + articles[i].url); 70 document.title = articles[i].title; 71 //console.log(ga('send', 'pageview', articles[i].url)); 72 dataLayer.push({'event': 'IS', 'eventCategory': 'IS', 'eventAction': 'scroll','eventLabel': 'INFINITE-SCROLL','eventValue': '0'}) 73 74 ga('set', { 75 page: articles[i].url, 76 title: articles[i].title 77 //title: 'infinite scroll post - '+articles[i].url 78 }); 79 ga('send', 'pageview'); 80 81 } 82 83 break; 84 } 85 86 } 87 88 } 89 90 if (checkForLoad && $(window).scrollTop() >= $(document).height() - $(window).height() - loadTriggerOffset) { 91 92 checkForLoad = false; 93 94 var ajaxLoading = document.getElementById("ajaxLoading"); 95 96 ajaxLoading.className = "true"; 97 98 var post_ids = []; 99 100 $(".ta_post_binder").each(function() { 101 102 post_ids.push($(this).attr("ta_post_id")); 103 104 }); 105 106 var encoded_post_ids = JSON.stringify(post_ids); 107 108 var prevType; 109 110 var prevptype; 111 112 if($('.page_container .content-wrapper').last().hasClass('two_column')) { 113 114 prevType = 'two'; 115 116 } else { 117 118 prevType = 'one'; 119 120 } 121 122 if($('.page_container .content-wrapper').last().hasClass('picture-story')) { 123 124 prevptype = 'photo'; 125 126 } else { 127 128 prevptype = 'normal'; 129 130 } 131 132 133 var data = { 134 'action': 'ajax_load_post', 135 'post_ids': encoded_post_ids, 136 'scroll_tracker': scrollTracker, 137 'prev_type': prevType, 138 'prev_p_type': prevptype 139 }; 140 141 142 143 $.post(ajaxurl, data, function(response) { 144 145 ajaxLoading.className = ""; 146 147 //var articleDom = $.parseHTML(response); 148 149 //$('#ajaxLoading').before(articleDom); 150 151 $('#ajaxLoading').before(response); 152 153 var container = $('.ta_post_binder', response); 154 155 addArticleToCache(container); 156 157 ajaxInitEmbeds(); 158 159 scrollTracker++; 160 161 if ($('.nomopo').length < 1){ 162 163 checkForLoad = true; 164 165 } 166 167 }); 168 169 } 170 } 171 172 function ajaxInitEmbeds() { 173 174 if(scrollTracker) { 175 176 /* ADDTHIS */ 177 addthis.addEventListener( 'addthis.ready', loadAddThis() ); 178 179 function loadAddThis() { 180 addthis.init(); 181 addthis.layers.refresh(); 182 } 183 184 $('iframe[src*="youtube.com"]').each(function() { 185 var url = $(this).attr("src"); 186 $(this).attr("src",url+"&wmode=transparent"); 187 $(this).parent().addClass( "video-container" ); 188 }); 189 190 /* TABOOLA */ 191 192 // Infinite scroll refresh 193 //taboola_container_id_side = 'taboola-right-rail-thumbnails' + scrollTracker; 194 taboola_container_id = 'taboola-below-article-thumbnails' + scrollTracker; 195 196 // Find DOM element to contain the widget using above id 197 //$('.taboola-side').last().attr("id",taboola_container_id_side); 198 $('.taboola-inf').last().attr("id",taboola_container_id); 199 200 window._taboola = window._taboola || []; 201 202 // if ($(window).width() > 768){ 203 204 // _taboola.push({ 205 // mode: 'organic-thumbnails-rr', 206 // container: taboola_container_id_side,
207 // placement: 'Right Rail Thumbnails', 208 // target_type: 'mix' 209 // }); 210 211 // } 212 213 _taboola.push({ 214 mode: 'organic-thumbnails-a', 215 container: taboola_container_id, 216 placement: 'Below Article Thumbnails', 217 target_type: 'mix' 218 }); 219 220 _taboola.push({ article:'auto', url: window.location.href }); 221 222 } 223 224 /* TWITTER */ 225 twttr.widgets.load(); 226 227 /* INSTAGRAM */ 228 instgrm.Embeds.process(); 229 230 /* ADD THIS URL AND TITLE UPDATE */ 231 232 addthis.update('share', 'url', window.location.href); 233 addthis.update('share', 'title', document.title); 234 addthis.ready(); 235 236 /* SHARING BUTTONS */ 237 var script = '//s7.addthis.com/js/250/addthis_widget.js#domready=1'; 238 239 $.getScript(script); 240 $('.share').unbind( "click" ); 241 $('.share').click(function () { 242 $(this).toggleClass('extended'); 243 $(this).siblings(".extendshare").toggleClass('extended'); 244 }); 245 246 $('img, picture').removeAttr('title'); 247 248 249 } 250 251 if ($('html.single').length > 0) { 252 253 addArticleToCache($('.ta_post_binder')); 254 255 OnScroll(); 256 257 $(window).on("scroll", OnScroll); 258 259 } 260 261});
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.