/** * CatOS Core System Module * Main system initialization and state management */ class CatOSCore { constructor() { // System state this.windows = new Map(); this.apps = new Map(); this.nextWindowId = 1; this.focusedWindow = null; this.startMenuOpen = false; this.wallpapers = [ 'static/wallpapers/wallpaper1.png', 'static/wallpapers/wallpaper2.png', 'static/wallpapers/wallpaper3.png', 'static/wallpapers/wallpaper4.png', 'static/wallpapers/wallpaper5.png', 'static/wallpapers/wallpaper6.png' ]; } // Initialize CatOS init() { this.showLoadingScreen(); this.updateClock(); this.setRandomWallpaper(); // Boot sequence setTimeout(() => { this.hideLoadingScreen(); this.playStartupSound(); this.showWelcomeMessage(); }, 3000); } // Loading screen management showLoadingScreen() { const loadingScreen = document.getElementById('loading-screen'); if (loadingScreen) { loadingScreen.classList.remove('hidden'); } else { console.warn('Loading screen element not found'); } } hideLoadingScreen() { const loadingScreen = document.getElementById('loading-screen'); if (loadingScreen) { loadingScreen.classList.add('hidden'); setTimeout(() => { loadingScreen.style.display = 'none'; }, 500); } else { console.warn('Loading screen element not found'); } } // Clock functionality updateClock() { const updateTime = () => { const now = new Date(); const timeString = now.toLocaleTimeString('en-US', { hour12: false, hour: '2-digit', minute: '2-digit' }); const clockElement = document.querySelector('.time'); if (clockElement) { clockElement.textContent = timeString; } }; updateTime(); // Update immediately setInterval(updateTime, 1000); // Update every second } // Wallpaper management setRandomWallpaper() { const desktop = document.getElementById('desktop'); if (!desktop) return; const randomWallpaper = this.wallpapers[Math.floor(Math.random() * this.wallpapers.length)]; // Create a temporary image to preload const img = new Image(); img.onload = () => { desktop.style.backgroundImage = `url('${randomWallpaper}')`; desktop.style.backgroundSize = 'cover'; desktop.style.backgroundPosition = 'center'; desktop.style.backgroundRepeat = 'no-repeat'; }; img.src = randomWallpaper; } // System sounds and notifications playStartupSound() { // Cat-themed startup notification this.showNotification('🐱💻 CatOS Ready!', 'Welcome to your purr-fessional workspace!'); } showWelcomeMessage() { // Optional: Show welcome message for new users if (!localStorage.getItem('catos-visited')) { this.showNotification( '🎉 First time visitor detected!', 'Try opening the terminal and typing "help" for cat commands!' ); localStorage.setItem('catos-visited', 'true'); } } showNotification(title, message) { // Simple notification system const notification = document.createElement('div'); notification.className = 'system-notification'; notification.innerHTML = `