Акции Гродно на Игры и игрушки на 28 Июня 2019
Уведомления на новые акции в Telegram
Получать уведомления в Telegram
>en[i], root, maxHeight, tailHTML);
if (done) return true;
}
var tailSpan = document.createElement('span');
tailSpan.innerHTML = tailHTML;
node.parentNode.insertBefore(tailSpan, node.nextSibling);
var oldDisplay = node.style.display;
node.style.display = 'none';
if (root.scrollHeight <= maxHeight + 2) {
node.remove();
return true;
}
tailSpan.remove();
node.remove();
return false;
}
return false;
}
function markTruncated() {
var items = document.querySelectorAll('.discounts .item h3');
items.forEach(function(h3) {
if (h3.dataset.truncChecked) return;
// Сохраняем оригинальный HTML ДО начала каких-либо манипуляций
if (!h3.dataset.origHtml) {
h3.dataset.origHtml = h3.innerHTML;
}
var lineHeight = parseFloat(window.getComputedStyle(h3).lineHeight);
if (isNaN(lineHeight)) lineHeight = 23.4;
var maxHeight = lineHeight * 3;
if (h3.scrollHeight > maxHeight) {
h3.dataset.truncChecked = '1';
var tailHTML = '
... ещё \u203A';
var children = Array.from(h3.childNodes);
for (var i = children.length - 1; i >= 0; i--) {
if (truncateNode(children[i], h3, maxHeight, tailHTML)) break;
}
} else {
h3.dataset.truncChecked = '1';
}
});
}
setTimeout(markTruncated, 100);
setTimeout(markTruncated, 500);
setTimeout(markTruncated, 1500);
// Подгруженные через API товары
var discounts = document.querySelector('.discounts');
if (discounts) {
var observer = new MutationObserver(function() {
setTimeout(markTruncated, 200);
});
observer.observe(discounts, { childList: true });
}
});