Spaces:
Running
Running
// Shared JavaScript across all pages console.log('Rusty Fortune Casino loaded'); // Real-time jackpot counter animation function animateJackpotCounter() { const jackpotElement = document.querySelector('.jackpot-amount'); if (jackpotElement) { let currentValue = 148.14; const targetValue = 200.00; const duration = 5000; const steps = 60; const stepValue = (targetValue - currentValue) / steps; let step = 0; const counter = setInterval(() => { if (step >= steps) { clearInterval(counter); return; } currentValue += stepValue; jackpotElement.textContent = `${currentValue.toFixed(2)}`; step++; }, duration / steps); } } // Chat auto-scroll function scrollChatToBottom() { const chatContainer = document.querySelector('.custom-scrollbar'); if (chatContainer) { chatContainer.scrollTop = chatContainer.scrollHeight; } // Flash giveaway countdown function startFlashGiveawayCountdown() { const giveawayElement = document.querySelector('.flash-giveaway-timer'); if (giveawayElement) { let seconds = 30; const timer = setInterval(() => { if (seconds <= 0) { clearInterval(timer); giveawayElement.textContent = 'Starting now!'; } else { giveawayElement.textContent = `Starting in ${seconds} seconds...`; seconds--; }, 1000); } } // Initialize when DOM is loaded document.addEventListener('DOMContentLoaded', function() { animateJackpotCounter(); scrollChatToBottom(); startFlashGiveawayCountdown(); // Add hover effects to game cards const gameCards = document.querySelectorAll('.game-card'); gameCards.forEach(card => { card.addEventListener('mouseenter', () => { card.classList.add('hover-glow'); }); card.addEventListener('mouseleave', () => { card.classList.remove('hover-glow'); }); }); }); // API integration for live data (placeholder) async function fetchJackpotData() { try { // In a real implementation, this would fetch from RustyPot API const mockData = { currentPot: 148.14, participants: 16, maxParticipants: 200, timeRemaining: 120 }; // Update UI with real data console.log('Jackpot data fetched:', mockData); } catch (error) { console.error('Error fetching jackpot data:', error); } } // Export functions for use in other modules window.RustyFortune = { animateJackpotCounter, scrollChatToBottom, startFlashGiveawayCountdown, fetchJackpotData };
c9326cf verified Download script.js from rewgods/rustyjackpot-revolution: direct link, hf CLI and curl.
- Browser
- Download file 2.8 kB
-
https://huggingface.co/spaces/rewgods/rustyjackpot-revolution/resolve/main/script.js
- Command line
-
hf download hf://spaces/rewgods/rustyjackpot-revolution/script.js
-
curl -L -o script.js https://huggingface.co/spaces/rewgods/rustyjackpot-revolution/resolve/main/script.js
2.8 kB
| // Shared JavaScript across all pages | |
| console.log('Rusty Fortune Casino loaded'); | |
| // Real-time jackpot counter animation | |
| function animateJackpotCounter() { | |
| const jackpotElement = document.querySelector('.jackpot-amount'); | |
| if (jackpotElement) { | |
| let currentValue = 148.14; | |
| const targetValue = 200.00; | |
| const duration = 5000; | |
| const steps = 60; | |
| const stepValue = (targetValue - currentValue) / steps; | |
| let step = 0; | |
| const counter = setInterval(() => { | |
| if (step >= steps) { | |
| clearInterval(counter); | |
| return; | |
| } | |
| currentValue += stepValue; | |
| jackpotElement.textContent = `$${currentValue.toFixed(2)}`; | |
| step++; | |
| }, duration / steps); | |
| } | |
| } | |
| // Chat auto-scroll | |
| function scrollChatToBottom() { | |
| const chatContainer = document.querySelector('.custom-scrollbar'); | |
| if (chatContainer) { | |
| chatContainer.scrollTop = chatContainer.scrollHeight; | |
| } | |
| // Flash giveaway countdown | |
| function startFlashGiveawayCountdown() { | |
| const giveawayElement = document.querySelector('.flash-giveaway-timer'); | |
| if (giveawayElement) { | |
| let seconds = 30; | |
| const timer = setInterval(() => { | |
| if (seconds <= 0) { | |
| clearInterval(timer); | |
| giveawayElement.textContent = 'Starting now!'; | |
| } else { | |
| giveawayElement.textContent = `Starting in ${seconds} seconds...`; | |
| seconds--; | |
| }, 1000); | |
| } | |
| } | |
| // Initialize when DOM is loaded | |
| document.addEventListener('DOMContentLoaded', function() { | |
| animateJackpotCounter(); | |
| scrollChatToBottom(); | |
| startFlashGiveawayCountdown(); | |
| // Add hover effects to game cards | |
| const gameCards = document.querySelectorAll('.game-card'); | |
| gameCards.forEach(card => { | |
| card.addEventListener('mouseenter', () => { | |
| card.classList.add('hover-glow'); | |
| }); | |
| card.addEventListener('mouseleave', () => { | |
| card.classList.remove('hover-glow'); | |
| }); | |
| }); | |
| }); | |
| // API integration for live data (placeholder) | |
| async function fetchJackpotData() { | |
| try { | |
| // In a real implementation, this would fetch from RustyPot API | |
| const mockData = { | |
| currentPot: 148.14, | |
| participants: 16, | |
| maxParticipants: 200, | |
| timeRemaining: 120 | |
| }; | |
| // Update UI with real data | |
| console.log('Jackpot data fetched:', mockData); | |
| } catch (error) { | |
| console.error('Error fetching jackpot data:', error); | |
| } | |
| } | |
| // Export functions for use in other modules | |
| window.RustyFortune = { | |
| animateJackpotCounter, | |
| scrollChatToBottom, | |
| startFlashGiveawayCountdown, | |
| fetchJackpotData | |
| }; |