Справа аб супрацоўніцтве
document.querySelectorAll('.section-banner-image-text5-20015-list-item-text-slide-text-list').forEach(ul => {
const liElements = ul.querySelectorAll('li');
const combinedText = Array.from(liElements).map(li => li.textContent).join(' ');
const tempElement = document.createElement('div');
tempElement.style.position = 'absolute';
tempElement.style.visibility = 'hidden';
tempElement.style.height = 'auto';
tempElement.style.width = getComputedStyle(ul).width;
tempElement.style.lineHeight = getComputedStyle(ul).lineHeight;
tempElement.textContent = combinedText;
document.body.appendChild(tempElement);
const totalHeight = tempElement.scrollHeight;
const lineHeight = parseFloat(getComputedStyle(tempElement).lineHeight);
const lineCount = Math.floor(totalHeight / lineHeight);
document.body.removeChild(tempElement);
if (lineCount > 9) {
ul.classList.add('text-expand-close');
const expandLink = document.createElement('a');
expandLink.className = 'expand-link';
expandLink.href = '#';
expandLink.innerText = 'Expand»';
expandLink.onclick = (e) => {
e.preventDefault();
if (ul.classList.contains('text-expand-close')) {
ul.classList.remove('text-expand-close');
expandLink.innerText = 'Close«';
} else {
ul.classList.add('text-expand-close');
expandLink.innerText = 'Expand»';
}
};
ul.parentNode.insertBefore(expandLink, ul.nextSibling);
}
});