<!-- Показать больше через скрытие/показ контента. https://t.me/breeze_tilda -->
<script>
(function () {
var buttonSelector = 'a[href="#showmore"]';
var blockSelector = '.uc-showmore';
function init() {
var buttons = document.querySelectorAll(buttonSelector);
var blocks = document.querySelectorAll(blockSelector);
blocks.forEach(function (block) {
block.style.setProperty('display', 'none', 'important');
});
buttons.forEach(function (button) {
button.addEventListener('click', function (event) {
event.preventDefault();
blocks.forEach(function (block) {
block.style.setProperty('display', 'block', 'important');
});
button.style.setProperty('display', 'none', 'important');
var parentBlock = button.closest('.r');
if (parentBlock) {
parentBlock.style.setProperty('display', 'none', 'important');
}
window.dispatchEvent(new Event('resize'));
setTimeout(function () {
if (blocks[0]) {
blocks[0].scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
}, 100);
});
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script> <!-- Табы с фильтрацией категорий. https://t.me/breeze_tilda -->
<script>
(function () {
var cats = ['circle', 'dots', 'gear', 'pulse', 'other'];
function getBlock(cat) {
return document.querySelector('.uc-' + cat);
}
function hideAllBlocks() {
cats.forEach(function (cat) {
var block = getBlock(cat);
if (block) {
block.style.setProperty('display', 'none', 'important');
}
});
}
function showBlock(cat, scroll) {
hideAllBlocks();
var block = getBlock(cat);
if (!block) {
return;
}
block.style.setProperty('display', 'block', 'important');
window.dispatchEvent(new Event('resize'));
if (scroll) {
setTimeout(function () {
block.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}, 100);
}
}
function init() {
hideAllBlocks();
document.addEventListener('click', function (event) {
var link = event.target.closest('a');
if (!link) {
return;
}
var href = link.getAttribute('href');
if (!href || href.charAt(0) !== '#') {
return;
}
var cat = href.substring(1);
if (!cats.includes(cat)) {
return;
}
event.preventDefault();
event.stopPropagation();
showBlock(cat, true);
history.pushState(null, '', '#' + cat);
}, true);
var currentHash = window.location.hash.substring(1);
if (cats.includes(currentHash)) {
showBlock(currentHash, false);
}
window.addEventListener('popstate', function () {
var hash = window.location.hash.substring(1);
if (cats.includes(hash)) {
showBlock(hash, true);
} else {
hideAllBlocks();
}
});
/*
Если нужно показывать первый блок сразу,
раскомментируйте строку ниже:
showBlock(cats[0], false);
*/
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script> <!-- Табы с хэш-навигацией и прокруткой. https://t.me/breeze_tilda -->
<script>
document.addEventListener('DOMContentLoaded', function () {
var cats = ['circle', 'dots', 'gear', 'pulse', 'other'];
cats.forEach(function(cat){
var block = document.querySelector('.uc-' + cat);
if (block) block.style.display = 'none';
});
function showBlock(cat) {
cats.forEach(function(c){
var b = document.querySelector('.uc-' + c);
if (b) b.style.display = 'none';
});
var block = document.querySelector('.uc-' + cat);
if (block) {
block.style.display = 'block';
block.scrollIntoView({ behavior: 'smooth' });
}
}
document.addEventListener('click', function(e) {
var link = e.target.closest('a');
if (link && link.href) {
var href = link.getAttribute('href');
if (href && href.startsWith('#')) {
var cat = href.replace('#', '');
if (cats.includes(cat)) {
e.preventDefault();
e.stopPropagation();
showBlock(cat);
history.pushState(null, null, '#' + cat);
}
}
}
}, true);
var hash = window.location.hash.replace('#', '');
if (hash && cats.includes(hash)) {
showBlock(hash);
} else {
var firstBlock = document.querySelector('.uc-' + cats[0]);
if (firstBlock) firstBlock.style.display = 'block';
}
window.addEventListener('hashchange', function() {
var hash = window.location.hash.replace('#', '');
if (hash && cats.includes(hash)) {
showBlock(hash);
}
});
});
</script>