<!-- Табы с хэш-навигацией и прокруткой. 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>