ADAM OS v25.5 FILE EDIT VIEW
LOCAL ENV
00:00
`; // 2. LBO Modeler App Logic & UI const lboAppHTML = ` `; /* --- OS LOGIC --- */ function updateClock() { const now = new Date(); document.getElementById('clock').innerText = now.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); } setInterval(updateClock, 1000); updateClock(); function openApp(appId) { let title = ""; let content = ""; let width = 450; let height = 500; if(appId === 'dcf') { title = "DCF Valuator"; content = dcfAppHTML; } else if (appId === 'lbo') { title = "LBO Modeler"; content = lboAppHTML; width = 500; height = 550; } openWindow(appId, title, content, width, height); } function openWindow(id, title, htmlContent, w, h) { // Check if exists let win = document.getElementById(`win-${id}`); if (win) { bringToFront(win); return; } // Create Window win = document.createElement('div'); win.id = `win-${id}`; win.className = 'os-window active'; win.style.width = w + 'px'; win.style.height = h + 'px'; // Center roughly with random offset win.style.top = (10 + Math.random()*5) + '%'; win.style.left = (30 + Math.random()*5) + '%'; win.style.zIndex = ++zIndexCounter; win.innerHTML = `
${title}
`; document.getElementById('desktop').appendChild(win); const dot = document.getElementById(`dot-${id}`); if(dot) dot.classList.add('running'); win.onmousedown = () => bringToFront(win); lucide.createIcons(); } function closeWindow(id) { const win = document.getElementById(`win-${id}`); if(win) win.remove(); const dot = document.getElementById(`dot-${id}`); if(dot) dot.classList.remove('running'); } function bringToFront(el) { document.querySelectorAll('.os-window').forEach(w => w.classList.remove('active')); el.classList.add('active'); el.style.zIndex = ++zIndexCounter; } // Drag Logic let isDragging = false; let dragOffset = { x: 0, y: 0 }; let currentWindow = null; function startDrag(e, id) { isDragging = true; currentWindow = document.getElementById(`win-${id}`); bringToFront(currentWindow); const rect = currentWindow.getBoundingClientRect(); dragOffset.x = e.clientX - rect.left; dragOffset.y = e.clientY - rect.top; // Overlay to capture mouse events over iframe const overlay = document.createElement('div'); overlay.id = 'drag-overlay'; overlay.style.position = 'absolute'; overlay.style.inset = '0'; overlay.style.zIndex = '999'; currentWindow.appendChild(overlay); document.body.style.userSelect = 'none'; } document.addEventListener('mousemove', (e) => { if (!isDragging || !currentWindow) return; let x = e.clientX - dragOffset.x; let y = e.clientY - dragOffset.y; if(y < 32) y = 32; currentWindow.style.left = x + 'px'; currentWindow.style.top = y + 'px'; }); document.addEventListener('mouseup', () => { if(isDragging && currentWindow) { const overlay = currentWindow.querySelector('#drag-overlay'); if(overlay) overlay.remove(); } isDragging = false; currentWindow = null; document.body.style.userSelect = 'auto'; }); function toggleFullScreen() { if (!document.fullscreenElement) { document.documentElement.requestFullscreen(); } else { if (document.exitFullscreen) { document.exitFullscreen(); } } }