1'use strict' 2 3function adaptiveHeight(blocks) { 4 const divBlocks = document.querySelectorAll(blocks); 5 6 let maxHeight = 0; 7 8 divBlocks.forEach(block => { 9 const blockHeight = block.clientHeight; 10 11 if (blockHeight > maxHeight) { 12 maxHeight = blockHeight; 13 } 14 }); 15 16 divBlocks.forEach(block => { 17 block.style.height = maxHeight + 'px'; 18 }); 19} 20 21const ProductImpression = function(target, items) { 22 let observer = new IntersectionObserver((entries, observer) => { 23 entries.forEach(entry => { 24 if (entry.isIntersecting) { 25 const target = entry.target; 26 let targetPosition = { 27 top: window.pageYOffset + target.getBoundingClientRect().top, 28 left: window.pageXOffset + target.getBoundingClientRect().left, 29 right: window.pageXOffset + target.getBoundingClientRect().right, 30 bottom: window.pageYOffset + target.getBoundingClientRect().bottom 31 }; 32 33 let windowPosition = { 34 top: window.pageYOffset, 35 left: window.pageXOffset, 36 right: window.pageXOffset + document.documentElement.clientWidth, 37 bottom: window.pageYOffset + document.documentElement.clientHeight 38 }; 39 40 if ( 41 targetPosition.bottom > windowPosition.top && 42 targetPosition.top < windowPosition.bottom && 43 targetPosition.right > windowPosition.left && 44 targetPosition.left < windowPosition.right && 45 !target.dataset.processed // ÐÑовеÑÑем, бÑл ли блок Ñже обÑабоÑан 46 ) { 47 if (items.length > 0) { 48 const impressions = []; 49 50 for (const key in items) { 51 if (items.hasOwnProperty(key)) { 52 const item = items[key]; 53 impressions.push({ 54 product_id: item.product_id, 55 container_type: item.container_type 56 }); 57 } 58 } 59 60 eS('sendEvent', 'ProductImpressions', { 61 "ProductImpression": impressions 62 }); 63 64 target.dataset.processed = true; // УÑÑанавливаем Ñлаг, ÑÑо блок бÑл обÑабоÑан 65 observer.unobserve(target); // ÐÑекÑаÑаем оÑÑлеживаÑÑ ÑÑÐ¾Ñ ÑлеменÑ, Ñак как он Ñже бÑл обÑабоÑан 66 } 67 } 68 } 69 }); 70 }, { threshold: 0.5 }); // УÑÑанавливаем поÑог Ð´Ð»Ñ Ð¾Ð¿ÑÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð²Ð¸Ð´Ð¸Ð¼Ð¾ÑÑи 71 72 observer.observe(target); // ÐаÑинаем наблÑдение за ÑелевÑм ÑлеменÑом 73}; 74 75// Change lang 76function changeLang(evt) { 77 evt.preventDefault(); 78 const url = $(evt.currentTarget).attr('href'); 79 const lang = $(evt.currentTarget).attr('hreflang'); 80 81 if(url && lang) { 82 $.ajax({ 83 url: '/language-switch', 84 method: 'post', 85 data: {lang: lang}, 86 success: function(data){ 87 location.href = url 88 } 89 }); 90 } 91}
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.