This commit is contained in:
2026-03-07 12:09:01 +07:00
parent aa223ce3bb
commit 327b2645f2
124 changed files with 2189 additions and 1696 deletions

View File

@@ -0,0 +1,122 @@
<script>
(function () {
var menuTimer = null;
function getCatIds() {
return Array.from(document.querySelectorAll('[data-menu-cat]')).map(function (item) {
return item.getAttribute('data-menu-cat');
});
}
function switchCat(id) {
var catIds = getCatIds();
catIds.forEach(function (c) {
var item = document.getElementById('cat-' + c);
var panel = document.getElementById('rp-' + c);
if (item) item.classList.remove('cat-active');
if (panel) panel.style.display = 'none';
});
var activeItem = document.getElementById('cat-' + id);
var activePanel = document.getElementById('rp-' + id);
if (activeItem) activeItem.classList.add('cat-active');
if (activePanel) activePanel.style.display = 'flex';
}
function showMenu() {
cancelMenuClose();
closeShowroom();
var catIds = getCatIds();
if (catIds.length > 0) switchCat(catIds[0]);
var megaMenu = document.getElementById('mega-menu');
var overlay = document.getElementById('overlay');
if (megaMenu) megaMenu.classList.remove('hidden');
if (overlay) overlay.classList.remove('hidden');
}
function scheduleMenuClose() {
menuTimer = setTimeout(function () {
var megaMenu = document.getElementById('mega-menu');
var overlay = document.getElementById('overlay');
if (megaMenu) megaMenu.classList.add('hidden');
if (overlay) overlay.classList.add('hidden');
}, 150);
}
function cancelMenuClose() {
if (menuTimer) {
clearTimeout(menuTimer);
menuTimer = null;
}
}
function toggleShowroom() {
var panel = document.getElementById('showroom-panel');
var arrow = document.getElementById('showroom-arrow');
if (!panel || !arrow) return;
var isOpen = !panel.classList.contains('hidden');
closeAll();
if (!isOpen) {
panel.classList.remove('hidden');
var overlay = document.getElementById('overlay');
if (overlay) overlay.classList.remove('hidden');
arrow.style.transform = 'rotate(90deg)';
}
}
function closeShowroom() {
var panel = document.getElementById('showroom-panel');
var arrow = document.getElementById('showroom-arrow');
if (panel) panel.classList.add('hidden');
if (arrow) arrow.style.transform = '';
}
function closeAll() {
var megaMenu = document.getElementById('mega-menu');
var panel = document.getElementById('showroom-panel');
var overlay = document.getElementById('overlay');
var arrow = document.getElementById('showroom-arrow');
if (megaMenu) megaMenu.classList.add('hidden');
if (panel) panel.classList.add('hidden');
if (overlay) overlay.classList.add('hidden');
if (arrow) arrow.style.transform = '';
cancelMenuClose();
}
function showSearch() {
closeAll();
var popup = document.getElementById('search-popup');
if (!popup) return;
popup.classList.remove('hidden');
popup.style.display = 'flex';
}
function hideSearch() {
var popup = document.getElementById('search-popup');
if (!popup) return;
popup.style.display = 'none';
popup.classList.add('hidden');
}
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape') {
closeAll();
hideSearch();
}
});
window.switchCat = switchCat;
window.showMenu = showMenu;
window.scheduleMenuClose = scheduleMenuClose;
window.cancelMenuClose = cancelMenuClose;
window.toggleShowroom = toggleShowroom;
window.closeShowroom = closeShowroom;
window.closeAll = closeAll;
window.showSearch = showSearch;
window.hideSearch = hideSearch;
})();
</script>