// main.js - functionality for all sections document.addEventListener("DOMContentLoaded", () => { const sectionButtons = document.querySelectorAll(".sidebar button"); const sections = document.querySelectorAll(".section"); sectionButtons.forEach(button => { button.addEventListener("click", () => { sections.forEach(sec => sec.style.display = "none"); const target = document.getElementById(button.dataset.target); if (target) target.style.display = "block"; }); }); // Chat logic const chatInput = document.querySelector(".chat-input"); const chatWindow = document.querySelector(".chat-window"); if (chatInput && chatWindow) { chatInput.addEventListener("keypress", e => { if (e.key === "Enter" && chatInput.value.trim()) { const msg = document.createElement("div"); msg.textContent = `Dripxy: ${chatInput.value}`; msg.style.padding = "5px 0"; chatWindow.appendChild(msg); chatInput.value = ""; chatWindow.scrollTop = chatWindow.scrollHeight; } }); } // Gambling logic const gameSelect = document.querySelector(".game-select"); const gambleInterface = document.querySelector(".gamble-interface"); const gambleButton = document.querySelector(".gamble-button"); if (gameSelect && gambleInterface && gambleButton) { gambleButton.addEventListener("click", () => { const game = gameSelect.value; let result; if (game === "coinflip") { result = Math.random() < 0.5 ? "You lost!" : "You won!"; } else if (game === "mines") { result = Math.random() < 0.3 ? "Boom! You lost." : "Safe! You won."; } else if (game === "blackjack") { result = Math.random() < 0.4 ? "Dealer wins!" : "You win!"; } const msg = document.createElement("div"); msg.textContent = `${game.toUpperCase()}: ${result}`; msg.style.padding = "5px 0"; gambleInterface.appendChild(msg); gambleInterface.scrollTop = gambleInterface.scrollHeight; }); } // Leaderboard logic const leaderboardTable = document.querySelector(".leaderboard-table"); if (leaderboardTable) { const dummyData = [ { user: "Dripxy", score: 99999 }, { user: "Player1", score: 88888 }, { user: "Player2", score: 77777 } ]; dummyData.forEach(entry => { const row = document.createElement("tr"); row.innerHTML = `${entry.user}${entry.score}`; leaderboardTable.appendChild(row); }); } });