1$(function() { 2 const descriptions = $(".cooperation-description"); 3 const items = $(".cooperation-itm"); 4 const arrow = $(".arrow-picker"); 5 let scrolling = false; 6 7 function replaceImgWithSvg() { 8 items.find("img").each(function () { 9 const img = $(this); 10 const imgSrc = img.attr("src"); 11 12 fetch(imgSrc) 13 .then((response) => response.text()) 14 .then((svgContent) => { 15 const parser = new DOMParser(); 16 const svgElement = parser 17 .parseFromString(svgContent, "image/svg+xml") 18 .querySelector("svg"); 19 20 if (svgElement) { 21 svgElement.setAttribute("class", img.attr("class") || ""); 22 svgElement.setAttribute("width", img.attr("width")); 23 svgElement.setAttribute("height", img.attr("height")); 24 25 img.replaceWith(svgElement); 26 } 27 }) 28 }); 29 } 30 replaceImgWithSvg() 31 32 function initLayout() { 33 items.off('click'); 34 $('.cooperation-items .wp-block-column').off('click'); 35 36 if (window.innerWidth > 1144) { 37 descriptions.each(function(index, element) { 38 element.style.display = 'none'; 39 }); 40 41 $('.cooperation').after($('.cooperation-description-items')); 42 43 items.each(function(index, element) { 44 $(element).bind("click", function() { 45 items.each(function(i, el) { 46 $(el).removeClass('active'); 47 }); 48 49 $(element).addClass('active'); 50 51 if (descriptions[index]) { 52 descriptions.each(function(i, desc) { 53 desc.style.display = 'none'; 54 }); 55 descriptions[index].style.display = 'flex'; 56 } 57 58 const offset = $(element).offset(); 59 const width = $(element).outerWidth(); 60 const arrowWidth = arrow.outerWidth(); 61 const errorOfMargin = window.innerWidth > 1400 ? window.innerWidth - 1400 : 0; 62 63 const center = offset.left + (width / 2) - (arrowWidth / 2) - (errorOfMargin / 2); 64 65 arrow.css({ left: center + 'px' }); 66 67 if (scrolling) { 68 const scrollTo = $(arrow).offset().top + $(arrow).outerHeight() - 225; 69 70 $('html, body').animate({ 71 scrollTop: scrollTo 72 }, 500); 73 } 74 }); 75 }); 76 } else { 77 $('.cooperation-items .wp-block-column').on('click', function(element) { 78 $('.cooperation-itm').removeClass('active'); 79 80 $(this).find('.cooperation-itm').addClass('active'); 81 82 83 const description = $('.cooperation-description-items'); 84 $(this).after(description); 85 86 descriptions.each(function(i, desc) { 87 desc.style.display = 'none'; 88 }); 89 descriptions[$(this).index()].style.display = 'flex'; 90 91 arrow.css({left: 'auto'}); 92 93 if (scrolling) { 94 const scrollTo = $(arrow).offset().top + $(arrow).outerHeight() - 200; 95 96 $('html, body').animate({ 97 scrollTop: scrollTo 98 }, 500); 99 } 100 }); 101 } 102 103 $(items).eq(0).trigger("click"); 104 105 scrolling = true; 106 } 107 108 initLayout(); 109 110 $(window).resize(function() { 111 scrolling = false; 112 descriptions.each(function(index, element) { 113 element.style.display = 'none'; 114 }); 115 116 initLayout(); 117 }); 118});
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.