|
|
|
|
|
|
|
|
class TimberstackApp { |
|
|
constructor() { |
|
|
this.init(); |
|
|
} |
|
|
|
|
|
init() { |
|
|
this.createSnowEffect(); |
|
|
this.setupEventListeners(); |
|
|
this.loadSystemStatus(); |
|
|
} |
|
|
|
|
|
|
|
|
createSnowEffect() { |
|
|
const snowContainer = document.querySelector('.snow-container'); |
|
|
if (!snowContainer) return; |
|
|
|
|
|
for (let i = 0; i < 50; i++) { |
|
|
const snowflake = document.createElement('div'); |
|
|
snowflake.className = 'snowflake'; |
|
|
|
|
|
const size = Math.random() * 4 + 2; |
|
|
snowflake.style.width = `${size}px`; |
|
|
snowflake.style.height = `${size}px`; |
|
|
snowflake.style.left = `${Math.random() * 100}vw`; |
|
|
snowflake.style.animationDuration = `${Math.random() * 3 + 2}s`; |
|
|
snowflake.style.animationDelay = `${Math.random() * 5}s`; |
|
|
|
|
|
snowContainer.appendChild(snowflake); |
|
|
} |
|
|
} |
|
|
|
|
|
setupEventListeners() { |
|
|
|
|
|
document.addEventListener('keydown', (e) => { |
|
|
if (e.ctrlKey && e.key === 'k') { |
|
|
e.preventDefault(); |
|
|
this.toggleCommandPalette(); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
toggleCommandPalette() { |
|
|
|
|
|
console.log('Command palette toggled'); |
|
|
} |
|
|
|
|
|
loadSystemStatus() { |
|
|
|
|
|
const systemData = { |
|
|
temperature: 42, |
|
|
load: 68, |
|
|
uptime: '14d 8h 32m', |
|
|
threats: 3, |
|
|
power: 94 |
|
|
}; |
|
|
|
|
|
this.updateDashboard(systemData); |
|
|
} |
|
|
|
|
|
updateDashboard(data) { |
|
|
|
|
|
console.log('Updating dashboard with:', data); |
|
|
} |
|
|
|
|
|
|
|
|
simulateBootSequence() { |
|
|
const bootMessages = [ |
|
|
'> INITIALIZING TIMBERSTACK TERMINAL...', |
|
|
'> LOADING SURVIVAL PROTOCOLS...', |
|
|
'> SCANNING FOR THREATS...', |
|
|
'> SYSTEMS NOMINAL', |
|
|
'> WELCOME BACK, SURVIVALIST' |
|
|
]; |
|
|
|
|
|
|
|
|
return bootMessages; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => { |
|
|
new TimberstackApp(); |
|
|
}); |
|
|
|
|
|
|
|
|
const Utils = { |
|
|
formatUptime(seconds) { |
|
|
const days = Math.floor(seconds / 86400); |
|
|
const hours = Math.floor((seconds % 86400) / 3600); |
|
|
const minutes = Math.floor((seconds % 3600) / 60); |
|
|
return `${days}d ${hours}h ${minutes}m`; |
|
|
}, |
|
|
|
|
|
generateId() { |
|
|
return Math.random().toString(36).substr(2, 9); |
|
|
}, |
|
|
|
|
|
debounce(func, wait) { |
|
|
let timeout; |
|
|
return function executedFunction(...args) { |
|
|
const later = () => { |
|
|
clearTimeout(timeout); |
|
|
func(...args); |
|
|
}; |
|
|
clearTimeout(timeout); |
|
|
timeout = setTimeout(later, wait); |
|
|
}; |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
window.TimberstackUtils = Utils; |