1 2(function(){ 3 4var isInfiniteScroll = document.querySelector('main'); 5var isBlog = false; 6 7// if (typeof(isInfiniteScroll) == 'undefined' || isInfiniteScroll == null) { 8// isInfiniteScroll = document.querySelector('#InfiniteScrollEN'); 9// isBlog = true; 10// } 11 12if (typeof(isInfiniteScroll) != 'undefined' && isInfiniteScroll != null) { 13 14 var querySelectors = [ 15 ['meta','name','title'], 16 ['meta','name','description'], 17 ['meta','name','news_keywords'], 18 ['meta','name','keywords'], 19 ['meta','property','og:url'], 20 ['meta','property','og:title'], 21 ['meta','property','og:image'], 22 ['meta','property','og:image:url'], 23 ['meta','property','og:image:secure_url'], 24 ['meta','name','twitter:url'], 25 ['meta','name','twitter:image'], 26 ['meta','property','article:published_time'], 27 ['meta','property','article:modified_time'], 28 ['meta','property','og:description'], 29 ['meta','property','og:updated_time'], 30 ['meta','name','twitter:title'], 31 ['meta','name','twitter:description'], 32 ['meta','name','twitter:image:alt'], 33 ['meta','property','article:tag'], 34 ['meta','property','article:section'], 35 ['meta','property','og:audio'], 36 ['meta','property','og:audio:title'], 37 ['meta','name','robots'], 38 ['link','rel','canonical'], 39 ['link','rel','image_src'], 40 ['link','rel','amphtml'], 41 ['script','type','application/ld+json'], 42 ['title','',''] 43 ]; 44 45 var dataInfiniteScroll = []; 46 var elmInfiniteScroll = []; 47 var headsInfiniteScroll = []; 48 var maxInfiniteScroll = 0; 49 var minInfiniteScroll = 0; 50 var triggerInfiniteScroll = 1; 51 var countInfiniteScroll = 0; 52 var urlInfiniteScroll = ''; 53 var pageInfiniteScroll = 0; 54 var curInfiniteScroll = window.location.href; 55 curInfiniteScroll = curInfiniteScroll.replace(/^.*\/\/[^\/]+/, ''); 56 curInfiniteScroll = curInfiniteScroll.split('?')[0]; 57 var curtitleInfiniteScroll = document.getElementsByTagName("title")[0].innerHTML; 58 var windowlocationhref = curInfiniteScroll; 59// if (document.querySelector('.ya-share2:not(.r)')) { 60// document.querySelector('.ya-share2:not(.r)').classList.add("r"); 61// } 62 63 var headsTopInfiniteScroll = []; 64 var itemN = 0; 65 for (let item of querySelectors) { 66 if (item[1]) { 67 var itemS = item[0]+'['+item[1]+'="'+item[2]+'"]'; 68 } else { 69 var itemS = item[0]; 70 } 71 if (document.querySelector(itemS)) { 72 if (itemN < 23) { 73 headsTopInfiniteScroll[itemN] = document.querySelector(itemS).content; 74 } else if (itemN < 26) { 75 headsTopInfiniteScroll[itemN] = document.querySelector(itemS).href; 76 } else if (itemN < 28) { 77 headsTopInfiniteScroll[itemN] = document.querySelector(itemS).innerHTML; 78 } 79 } else { 80 headsTopInfiniteScroll[itemN] = ''; 81 } 82 itemN++; 83 } 84 85 var jsonFile = '/news'; 86// if (isBlog) {jsonFile = '/blog';} 87// var jsonLinks = document.querySelectorAll('a[itemprop="url"]'); 88// // console.log(jsonLinks); 89// for (let jsonLink of jsonLinks) { 90// var iprom = jsonLink.querySelector('meta[itemprop="position"]'); 91// if (iprom && iprom.content == '2') { 92// jsonFile = jsonLink.getAttribute("href"); 93// } 94// } 95// console.log(jsonFile); 96 97 var XHR = ("onload" in new XMLHttpRequest()) ? XMLHttpRequest : XDomainRequest; 98 var xhr = new XHR(); 99 xhr.open('GET', '/c/b'+jsonFile+'.json', true); 100 xhr.onload = function() { 101 102 dataInfiniteScroll = this.responseText.split(','); 103 // console.log(dataInfiniteScroll); 104 105 if (dataInfiniteScroll.length > 0) { 106 // console.log('array en ' + dataInfiniteScroll.length); 107 window.addEventListener('scroll', function() { 108 109 if ((document.documentElement.scrollTop > 0 || document.body.scrollTop > 0) && triggerInfiniteScroll == 1) { 110 triggerInfiniteScroll = 0; 111 countInfiniteScroll++;
112 urlInfiniteScroll = dataInfiniteScroll.shift(); 113 if (urlInfiniteScroll == curInfiniteScroll) { 114 urlInfiniteScroll = dataInfiniteScroll.shift(); 115 } 116 if (countInfiniteScroll > 5) { 117 return; 118 } 119// console.log('curInfiniteScroll ' + curInfiniteScroll); 120 // console.log('urlInfiniteScroll ' + urlInfiniteScroll); 121 var request1 = llgetXmlHttp(); 122 request1.open('GET', urlInfiniteScroll, true); 123 request1.onload = function (e) { 124 if (request1.readyState === 4) { 125 if (request1.status === 200) { 126 elmInfiniteScroll[countInfiniteScroll] = urlInfiniteScroll; 127 var boxright = document.querySelector("main"); 128 // if (typeof(boxright) == 'undefined' || boxright == null) { 129// boxright = document.querySelector('#InfiniteScrollEN'); 130// } 131 var nl = document.createElement("div"); 132 nl.classList.add("tempInfiniteScroll"); 133 nl = document.body.appendChild(nl); 134 nl.style.display="none"; 135 nl.innerHTML = request1.responseText; 136 137 headsInfiniteScroll[countInfiniteScroll] = []; 138 var itemN = 0; 139 for (let item of querySelectors) { 140 if (item[1]) { 141 var itemS = item[0]+'['+item[1]+'="'+item[2]+'"]'; 142 } else { 143 var itemS = item[0]; 144 } 145 if (nl.querySelector(itemS)) { 146 if (itemN < 23) { 147 headsInfiniteScroll[countInfiniteScroll][itemN] = nl.querySelector(itemS).content; 148 } else if (itemN < 26) { 149 headsInfiniteScroll[countInfiniteScroll][itemN] = nl.querySelector(itemS).href; 150 } else if (itemN < 28) { 151 headsInfiniteScroll[countInfiniteScroll][itemN] = nl.querySelector(itemS).innerHTML; 152 } 153 } else { 154 headsInfiniteScroll[countInfiniteScroll][itemN] = ''; 155 } 156 itemN++; 157 } 158 159 var adboxs = nl.getElementsByClassName("adc"); 160 var n = 1; 161 for (let adbox of adboxs) { 162 adbox.innerHTML = '<div id="adfox_X' + n + '-' + countInfiniteScroll +'"></div>'; 163 n++; 164 } 165 var nd = document.createElement("div"); 166 167 nd.innerHTML += '<div class="adif2" id="adfox_Xsn-' + countInfiniteScroll +'"></div><div class="article-container n InfiniteScrollB InfiniteScroll' + countInfiniteScroll + '">' + nl.querySelector(".article-container").innerHTML + '</div>'; 168 169 nd = boxright.appendChild(nd); 170 171 nl.parentNode.removeChild(nl); 172 173 let scripts = boxright.querySelectorAll('.InfiniteScroll' + countInfiniteScroll + ' script'); 174 for (let script of scripts) { 175 if (script.src) { 176 var x = script.src; 177 var y = document.createElement('script'); 178 y.defer = true; 179 y.src = x; 180 script.appendChild(y); 181 } else { 182 var x = script.innerHTML; 183 var y = document.createElement('script'); 184 y.defer = true; 185 y.text = x; 186 script.text = ''; 187 script.appendChild(y); 188 } 189 } 190 191// scrollToElementAdd(); 192var prefs = loadPreferences(); 193var personalized = prefs ? prefs.advertising : false;
194// console.log('prefs ' + prefs); 195// if (prefs && prefs.advertising) { 196 if (document.querySelector('#adfox_X1-'+countInfiniteScroll+':not(.r)')) { 197 document.querySelector('#adfox_X1-'+countInfiniteScroll+':not(.r)').classList.add("r"); 198// (adsbygoogle = window.adsbygoogle || []).push({}); 199 if (window.matchMedia("only screen and (max-device-width: 728px)").matches){ 200 window.yaContextCb.push(()=>{ 201 Ya.adfoxCode.create({ 202 ownerId: 261330, 203 containerId: 'adfox_X1-'+countInfiniteScroll, 204 params: { 205 p1: 'dmogq', 206 p2: 'gjzr', 207 'cookie-consent-flag': personalized ? 1 : 0, 208 'gdpr-consent-flag': personalized ? 1 : 0 209 }, 210 }) 211 }) 212 } else { 213 window.yaContextCb.push(()=>{ 214 Ya.adfoxCode.create({ 215 ownerId: 261330, 216 containerId: 'adfox_X1-'+countInfiniteScroll, 217 params: { 218 p1: 'dmogt', 219 p2: 'gjzs', 220 'cookie-consent-flag': personalized ? 1 : 0, 221 'gdpr-consent-flag': personalized ? 1 : 0 222 } 223 }) 224 }) 225 } 226 } 227 228 if (document.querySelector('#adfox_X2-'+countInfiniteScroll+':not(.r)')) { 229 document.querySelector('#adfox_X2-'+countInfiniteScroll+':not(.r)').classList.add("r"); 230// window.yaContextCb.push(() => { 231// Ya.Context.AdvManager.render({ 232// "blockId": "R-A-155688-137", 233// "renderTo": 'adfox_X2-'+countInfiniteScroll 234// }) 235// }) 236 if (window.matchMedia("only screen and (max-device-width: 728px)").matches){ 237 window.yaContextCb.push(()=>{ 238 Ya.adfoxCode.create({ 239 ownerId: 261330, 240 containerId: 'adfox_X2-'+countInfiniteScroll, 241 params: { 242 p1: 'dmogu', 243 p2: 'gjzr', 244 'cookie-consent-flag': personalized ? 1 : 0, 245 'gdpr-consent-flag': personalized ? 1 : 0 246 }, 247 }) 248 }) 249 } else { 250 window.yaContextCb.push(()=>{ 251 Ya.adfoxCode.create({ 252 ownerId: 261330, 253 containerId: 'adfox_X2-'+countInfiniteScroll, 254 params: { 255 p1: 'dmogw', 256 p2: 'gjzs', 257 'cookie-consent-flag': personalized ? 1 : 0, 258 'gdpr-consent-flag': personalized ? 1 : 0 259 } 260 }) 261 }) 262 } 263 } 264 265 266 if (document.querySelector('#adfox_X3-'+countInfiniteScroll+':not(.r)')) { 267 document.querySelector('#adfox_X3-'+countInfiniteScroll+':not(.r)').classList.add("r"); 268// window.yaContextCb.push(() => { 269// Ya.Context.AdvManager.render({ 270// "blockId": "R-A-155688-139", 271// "renderTo": 'adfox_X3-'+countInfiniteScroll 272// }) 273// }) 274 if (window.matchMedia("only screen and (max-device-width: 728px)").matches){ 275 window.yaContextCb.push(()=>{ 276 Ya.adfoxCode.create({ 277 ownerId: 261330, 278 containerId: 'adfox_X3-'+countInfiniteScroll, 279 params: { 280 p1: 'dmogx', 281 p2: 'gjzr',
282 'cookie-consent-flag': personalized ? 1 : 0, 283 'gdpr-consent-flag': personalized ? 1 : 0 284 }, 285 }) 286 }) 287 } else { 288 window.yaContextCb.push(()=>{ 289 Ya.adfoxCode.create({ 290 ownerId: 261330, 291 containerId: 'adfox_X3-'+countInfiniteScroll, 292 params: { 293 p1: 'dmogy', 294 p2: 'gjzs', 295 'cookie-consent-flag': personalized ? 1 : 0, 296 'gdpr-consent-flag': personalized ? 1 : 0 297 } 298 }) 299 }) 300 } 301 } 302 303 if (document.querySelector('#adfox_Xsn-'+countInfiniteScroll+':not(.r)')) { 304 document.querySelector('#adfox_Xsn-'+countInfiniteScroll+':not(.r)').classList.add("r"); 305// window.yaContextCb.push(() => { 306// Ya.Context.AdvManager.render({ 307// "blockId": "R-A-155688-134", 308// "renderTo": 'adfox_Xsn-'+countInfiniteScroll 309// }) 310// }) 311 if (window.matchMedia("only screen and (max-device-width: 728px)").matches){ 312 window.yaContextCb.push(()=>{ 313 Ya.adfoxCode.create({ 314 ownerId: 261330, 315 containerId: 'adfox_Xsn-'+countInfiniteScroll, 316 params: { 317 p1: 'dmohb', 318 p2: 'gjzr', 319 'cookie-consent-flag': personalized ? 1 : 0, 320 'gdpr-consent-flag': personalized ? 1 : 0 321 }, 322 }) 323 }) 324 } else { 325 window.yaContextCb.push(()=>{ 326 Ya.adfoxCode.create({ 327 ownerId: 261330, 328 containerId: 'adfox_Xsn-'+countInfiniteScroll, 329 params: { 330 p1: 'dmohc', 331 p2: 'gjzs', 332 'cookie-consent-flag': personalized ? 1 : 0, 333 'gdpr-consent-flag': personalized ? 1 : 0 334 } 335 }) 336 }) 337 } 338 } 339// } 340 341 342 } else {console.error(request1.statusText);} 343 } 344 }; 345 request1.send(null); 346 347 } 348 349 var listElm = document.querySelector('.InfiniteScroll' + countInfiniteScroll); 350 if (typeof(listElm) != 'undefined' && listElm != null) { 351 var window_bottom_position = window.scrollY + window.innerHeight; 352 var window_middle_position = window.scrollY + ((window_bottom_position - window.scrollY) / 2); 353 var element_top_position = getElementWindowTop(listElm); 354 355 var element_bottom_position = element_top_position + listElm.clientHeight; 356 if(element_top_position <= window_bottom_position){//+6000 357 triggerInfiniteScroll = 1; 358 } 359 } 360 361 // var pageInfiniteScroll = 0; 362 elmInfiniteScroll.forEach(function(item, i, arr) { 363 var listElm = document.querySelector('.InfiniteScroll' + i); 364 if (typeof(listElm) != 'undefined' && listElm != null) { 365 var window_scrollY = window.scrollY + window.innerHeight/2; 366 var element_top_position = getElementWindowTop(listElm); 367 var element_bottom_position = element_top_position + listElm.clientHeight; 368 if (maxInfiniteScroll < element_bottom_position) maxInfiniteScroll = element_bottom_position; 369 if (minInfiniteScroll > element_top_position || minInfiniteScroll == 0) minInfiniteScroll = element_top_position; 370 if(element_bottom_position >= window_scrollY && element_top_position <= window_scrollY ){ 371 pageInfiniteScroll = i; 372 } else { 373 if (minInfiniteScroll > window_scrollY) { 374 pageInfiniteScroll = 0; 375 } else { 376 if (maxInfiniteScroll < window_scrollY) { 377 pageInfiniteScroll = 0; 378 } 379 } 380 } 381 } 382 }); 383 384 if (pageInfiniteScroll > 0) { 385 if (windowlocationhref != elmInfiniteScroll[pageInfiniteScroll]) { 386 windowlocationhref = elmInfiniteScroll[pageInfiniteScroll]; 387 setLocation(elmInfiniteScroll[pageInfiniteScroll]); 388 389 var itemN = 0; 390 for (let item of querySelectors) { 391 if (item[1]) { 392 var itemS = item[0]+'['+item[1]+'="'+item[2]+'"]'; 393 } else { 394 var itemS = item[0]; 395 } 396 if (headsInfiniteScroll[pageInfiniteScroll][itemN]) { 397 if (document.querySelector(itemS)) { 398 if (itemN < 23) { 399 document.querySelector(itemS).content = headsInfiniteScroll[pageInfiniteScroll][itemN]; 400 } else if (itemN < 26) { 401 document.querySelector(itemS).href = headsInfiniteScroll[pageInfiniteScroll][itemN]; 402 } else if (itemN < 28) { 403 document.querySelector(itemS).innerHTML = headsInfiniteScroll[pageInfiniteScroll][itemN]; 404 } 405 } else { 406 if (itemN < 23) { 407 var meta = document.createElement('meta'); 408 meta.setAttribute(item[1], item[2]); 409 meta.content = headsInfiniteScroll[pageInfiniteScroll][itemN]; 410 } else if (itemN < 26) { 411 var meta = document.createElement('link'); 412 meta.setAttribute(item[1], item[2]); 413 meta.href = headsInfiniteScroll[pageInfiniteScroll][itemN]; 414 } else if (itemN < 27) { 415 var meta = document.createElement('script'); 416 meta.setAttribute(item[1], item[2]); 417 meta.text = headsInfiniteScroll[pageInfiniteScroll][itemN]; 418 } else if (itemN < 28) { 419 var meta = document.createElement('title'); 420 meta.text = headsInfiniteScroll[pageInfiniteScroll][itemN]; 421 } 422 document.getElementsByTagName('head')[0].appendChild(meta); 423 } 424 } else { 425 if (document.querySelector(itemS)) { 426 if (itemN < 23) { 427 document.querySelector(itemS).content = ''; 428 } else if (itemN < 26) { 429 document.querySelector(itemS).href = ''; 430 } else if (itemN < 28) { 431 document.querySelector(itemS).innerHTML = ''; 432 } 433 } 434 // var parent = document.getElementsByTagName('head'); 435 // var child = document.querySelector(itemS); 436 // parent.removeChild(child); 437 } 438 itemN++; 439 } 440 441 442 443// if (document.querySelector('.adg'+pageInfiniteScroll+':not(.r)')) { 444// document.querySelector('.adg'+pageInfiniteScroll+':not(.r)').classList.add("r"); 445// (adsbygoogle = window.adsbygoogle || []).push({}); 446// } 447 448// if (document.querySelector('.ya-share2:not(.r)')) { 449// var myShare = document.querySelector('.ya-share2:not(.r)'); 450// var share = Ya.share2(myShare, {}); 451// document.querySelector('.ya-share2:not(.r)').classList.add("r"); 452// } 453 454 455 // console.log(headsInfiniteScroll[pageInfiniteScroll][27]); 456 if (typeof gtag !== 'undefined') gtag('event', 'page_view', { page_title: headsInfiniteScroll[pageInfiniteScroll][27], page_location: 'https://www.belnovosti.by'+elmInfiniteScroll[pageInfiniteScroll], send_to: 'G-CWNDH7RNG7' }); 457 if (typeof ym !== 'undefined') ym(16666762, 'hit', 'https://www.belnovosti.by'+elmInfiniteScroll[pageInfiniteScroll], {title: document.querySelector('.InfiniteScroll' + pageInfiniteScroll).querySelector('h1').innerHTML});
458 // _tmr.push({id: "2662262", type: "pageView", start: (new Date()).getTime(), url: 'https://www.belnovosti.by'+elmInfiniteScroll[pageInfiniteScroll], title: headsInfiniteScroll[pageInfiniteScroll][27]}); 459 } 460 } else { 461 if (windowlocationhref != curInfiniteScroll) { 462 windowlocationhref = curInfiniteScroll; 463 setLocation(curInfiniteScroll); 464 465 var itemN = 0; 466 for (let item of querySelectors) { 467 if (item[1]) { 468 var itemS = item[0]+'['+item[1]+'="'+item[2]+'"]'; 469 } else { 470 var itemS = item[0]; 471 } 472 if (headsTopInfiniteScroll[itemN]) { 473 if (document.querySelector(itemS)) { 474 if (itemN < 23) { 475 document.querySelector(itemS).content = headsTopInfiniteScroll[itemN]; 476 } else if (itemN < 26) { 477 document.querySelector(itemS).href = headsTopInfiniteScroll[itemN]; 478 } else if (itemN < 28) { 479 document.querySelector(itemS).innerHTML = headsTopInfiniteScroll[itemN]; 480 } 481 } else { 482 if (itemN < 23) { 483 var meta = document.createElement('meta'); 484 meta.setAttribute(item[1], item[2]); 485 meta.content = headsTopInfiniteScroll[itemN]; 486 } else if (itemN < 26) { 487 var meta = document.createElement('link'); 488 meta.setAttribute(item[1], item[2]); 489 meta.href = headsTopInfiniteScroll[itemN]; 490 } else if (itemN < 27) { 491 var meta = document.createElement('script'); 492 meta.setAttribute(item[1], item[2]); 493 meta.text = headsTopInfiniteScroll[itemN]; 494 } else if (itemN < 28) { 495 var meta = document.createElement('title'); 496 meta.text = headsTopInfiniteScroll[itemN]; 497 } 498 document.getElementsByTagName('head')[0].appendChild(meta); 499 } 500 } else { 501 if (itemN < 23) { 502 document.querySelector(itemS).content = ''; 503 } else if (itemN < 26) { 504 document.querySelector(itemS).href = ''; 505 } else if (itemN < 28) { 506 document.querySelector(itemS).innerHTML = ''; 507 } 508 // var parent = document.getElementsByTagName('head'); 509 // var child = document.querySelector(itemS); 510 // parent.removeChild(child); 511 } 512 itemN++; 513 } 514 // console.log(curtitleInfiniteScroll); 515 if (typeof gtag !== 'undefined') gtag('event', 'page_view', { page_title: curtitleInfiniteScroll, page_location: 'https://www.belnovosti.by'+curInfiniteScroll, send_to: 'G-CWNDH7RNG7' }); 516 if (typeof ym !== 'undefined') ym(16666762, 'hit', 'https://www.belnovosti.by'+curInfiniteScroll, {title: curtitleInfiniteScroll});
517// _tmr.push({id: "2662262", type: "pageView", start: (new Date()).getTime(), url: 'https://www.belnovosti.by'+curInfiniteScroll, title: curtitleInfiniteScroll}); 518 } 519 } 520 521 522 }); 523 } 524 } 525 xhr.onerror = function() { 526 console.log( 'ÐÑибка ' + this.status ); 527 } 528 xhr.send(); 529 530 function llgetXmlHttp() {var xmlhttp;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}return xmlhttp;} 531 532 function getElementWindowTop(elem){ 533 return elem && typeof elem.getBoundingClientRect === 'function' ? elem.getBoundingClientRect().top - document.body.getBoundingClientRect().top : 0; 534 } 535 function setLocation(curLoc){ 536 try { 537 history.pushState(null, null, curLoc); 538 return; 539 } catch(e) {} 540 location.hash = '#' + curLoc; 541 } 542 543} 544})();
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.