<script>
document.addEventListener("DOMContentLoaded", function() {
(function () {
const backText = "Hide"; //Текст при клике
const samePlace = false; //Показывать Текст в одном месте true/false
const shortenElements = document.querySelectorAll('.shorten-text');
if (shortenElements.length > 0) {
shortenElements.forEach(element => {
element.classList.add('close-text');
if(samePlace) element.classList.add('same-place-text');
});
}
const showMoreButtons = document.querySelectorAll('.show-more-btn');
if (showMoreButtons.length > 0) {
showMoreButtons.forEach(button => {
button.addEventListener('click', function(event) {
this.classList.toggle('show-more-btn-active');
const parentShortenText = this.closest('.shorten-text');
if (parentShortenText) {
if (parentShortenText.classList.contains('close-text')) {
parentShortenText.classList.remove('close-text');
} else {
parentShortenText.classList.add('close-text');
}
}
const tnAtomElement = this.querySelector('.tn-atom');
if (tnAtomElement) {
if (!tnAtomElement.hasAttribute('data-original-text')) {
const originalText = tnAtomElement.textContent;
tnAtomElement.setAttribute('data-original-text', originalText);
}
const currentText = tnAtomElement.textContent;
const originalText = tnAtomElement.getAttribute('data-original-text');
if (currentText === backText) {
tnAtomElement.textContent = originalText;
} else {
tnAtomElement.textContent = backText;
}
}
const artboard = this.closest('.t396__artboard');
if (artboard && artboard.getAttribute('data-artboard-heightmode') === 'hug') {
if (typeof t396__updateAutoHeight === 'function') {
t396__updateAutoHeight(artboard);
} else {
console.warn('Функция t396__updateAutoHeight не найдена');
}
}
});
});
}
})();
});
</script>
<style>
.show-more-btn .tn-atom {
cursor: pointer;
transition: all 0.2s ease-in-out;
}
#allrecords .show-more-btn .tn-atom:hover {
color: #ff9999;
}
#allrecords .shorten-text.close-text .tn-elem:not(:first-child):not(.show-more-btn) {
display: none;
}
#allrecords .shorten-text.same-place-text:not(.close-text) .tn-elem:first-child {
display: none;
}
</style>