diff --git a/website/index.php b/website/index.php index 2ca19a76..adc9da6a 100644 --- a/website/index.php +++ b/website/index.php @@ -121,15 +121,39 @@ if (isset($_SESSION['steamid'])) { } } ?> -
@@ -290,188 +292,133 @@ if (isset($_SESSION['steamid'])) { const knivesData = ; const weaponCategories = ; - let currentFilter = 'all'; + function toggleCategory(category) { - const navItem = document.querySelector(`[data-category="${category}"]`); - const arrow = navItem.querySelector('.nav-arrow'); + const categoryHeader = document.querySelector(`.category-header[data-category="${category}"]`); + const weaponList = document.querySelector(`.weapon-list[data-category="${category}"]`); + const arrow = categoryHeader.querySelector('.nav-arrow'); - // Check if already active - if (navItem.classList.contains('active')) { - // Deactivate and show all + // Toggle the weapon list + if (weaponList.classList.contains('expanded')) { + // Collapse + weaponList.classList.remove('expanded'); arrow.textContent = '▶'; - hideCategoryWeapons(category); - showAllWeapons(); - currentFilter = 'all'; + categoryHeader.classList.remove('active'); } else { - // Activate and filter + // Collapse all other categories first + document.querySelectorAll('.weapon-list').forEach(list => { + list.classList.remove('expanded'); + }); + document.querySelectorAll('.category-header').forEach(header => { + header.classList.remove('active'); + header.querySelector('.nav-arrow').textContent = '▶'; + }); + + // Expand this category + weaponList.classList.add('expanded'); arrow.textContent = '▼'; - showCategoryWeapons(category); - filterWeaponsByCategory(category); - currentFilter = category; + categoryHeader.classList.add('active'); } } - function showCategoryWeapons(category) { - // Clear all active states - document.querySelectorAll('.nav-item').forEach(item => { - item.classList.remove('active'); - item.querySelector('.nav-arrow').textContent = '▶'; - }); + function showKnifeSkins() { + const overlay = document.getElementById('skinSelectionOverlay'); + const title = document.getElementById('overlayTitle'); + const skinGrid = document.getElementById('skinGrid'); + + title.textContent = 'Select Knife Skin'; - // Set active state - const navItem = document.querySelector(`[data-category="${category}"]`); - navItem.classList.add('active'); - navItem.querySelector('.nav-arrow').textContent = '▼'; + // Clear previous skins + skinGrid.innerHTML = ''; + + // Populate knife skins (all knife types) + Object.entries(knivesData).forEach(([knifeId, knife]) => { + if (knifeId != 0) { // Skip default knife + const skinItem = document.createElement('div'); + skinItem.className = 'skin-item'; + skinItem.onclick = () => equipKnife(knifeId); + + skinItem.innerHTML = ` +