1'use strict'; 2var urlParams = new URLSearchParams(window.location.search); 3var initPager = urlParams.get('page') ? urlParams.get('page') : 0; 4 5window.addEventListener('load', function () { 6 infiniteScroll(document.getElementsByClassName('infinite-load-term')[0]); 7}); 8 9function infiniteScroll(contentBlock) { 10 var trigger = contentBlock.querySelectorAll('[data-observe]')[0]; 11 12 var observer = new IntersectionObserver(function (entries, callback) { 13 entries.forEach(function (entry) { 14 if (entry.isIntersecting) { 15 var position = entry.target.dataset.nextCount; 16 changeUrl(position - 1); 17 18 if (entry.target.parentNode.classList.contains('init')) { 19 retrievePage(entry.target.parentNode, position); 20 } 21 } 22 }); 23 }); 24 25 if (trigger) { 26 observer.observe(trigger); 27 } 28} 29 30function changeUrl(pager) { 31 // Don't do anything if its initial page load. 32 if (initPager === pager) { 33 initPager = -1; 34 return; 35 } 36 37 var url = pager > 0 ? 38 window.location.origin + window.location.pathname + '?page=' + pager : 39 window.location.origin + window.location.pathname; 40 41 window.history.pushState(url, document.title, url); 42 43 if (typeof ga == 'function') { 44 ga('ief.send', { 45 hitType: 'pageview', 46 page: url, 47 title: document.title + ' | iefimerida.gr' 48 }); 49 // Send infinite load event for analysis. 50 ga('ief.send', 'event', 'Infinite News Load', 'page', pager); 51 } 52 53 if (typeof ma == 'function') { 54 ma.trackView(); 55 // Send infinite load event for analysis. 56 ma.trackEvent('Infinite News Load', 'page', 'page', pager); 57 } 58} 59 60function retrievePage(content, pager) { 61 var xhttp; 62 63 lazyLoadPushAds('in_category_1', pager); 64 xhttp = new XMLHttpRequest(); 65 xhttp.onreadystatechange = function () { 66 if (this.readyState == 4 && this.status == 200) { 67 var node = document.createElement('template'); 68 node.innerHTML = this.responseText; 69 var contentBlock = content.parentNode.appendChild(node.content.firstChild); 70 infiniteScroll(contentBlock); 71 } 72 }; 73 74 xhttp.open('GET', '/infinite-load/news/' + pager, true); 75 xhttp.setRequestHeader('Cache-Control', 'no-cache, no-store, max-age=0'); 76 xhttp.setRequestHeader('Pragma', 'no-cache'); 77 xhttp.send(); 78 79 content.classList.remove('init'); 80 content.classList.add('loaded'); 81}
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.