Download script.js from namht94/timberstack-survival-terminal: direct link, hf CLI and curl.
- Browser
- Download file 3.13 kB
-
https://huggingface.co/spaces/namht94/timberstack-survival-terminal/resolve/main/script.js
- Command line
-
hf download hf://spaces/namht94/timberstack-survival-terminal/script.js
-
curl -L -o script.js https://huggingface.co/spaces/namht94/timberstack-survival-terminal/resolve/main/script.js
3.13 kB
| // 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; |