File size: 3,133 Bytes
90e733d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
// Main application script for Timberstack
class TimberstackApp {
constructor() {
this.init();
}
init() {
this.createSnowEffect();
this.setupEventListeners();
this.loadSystemStatus();
}
// Create winter snow effect
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() {
// Global keyboard shortcuts
document.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 'k') {
e.preventDefault();
this.toggleCommandPalette();
}
});
}
toggleCommandPalette() {
// Command palette implementation
console.log('Command palette toggled');
}
loadSystemStatus() {
// Mock system status data
const systemData = {
temperature: 42,
load: 68,
uptime: '14d 8h 32m',
threats: 3,
power: 94
};
this.updateDashboard(systemData);
}
updateDashboard(data) {
// Update dashboard elements with real data
console.log('Updating dashboard with:', data);
}
// Simulate terminal boot sequence
simulateBootSequence() {
const bootMessages = [
'> INITIALIZING TIMBERSTACK TERMINAL...',
'> LOADING SURVIVAL PROTOCOLS...',
'> SCANNING FOR THREATS...',
'> SYSTEMS NOMINAL',
'> WELCOME BACK, SURVIVALIST'
];
// This would be used in the Gatehouse feature
return bootMessages;
}
}
// Initialize app when DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
new TimberstackApp();
});
// Utility functions
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);
};
}
};
// Export for use in components
window.TimberstackUtils = Utils; |