// Global JavaScript functions for RobloxBoost Pro // Initialize page document.addEventListener('DOMContentLoaded', function() { feather.replace(); // Animate numbers on load animateNumbers(); // Initialize tooltips initializeTooltips(); // Add smooth reveal animations observeElements(); }); // Animate counter numbers function animateNumbers() { const counters = document.querySelectorAll('[data-counter]'); counters.forEach(counter => { const target = parseInt(counter.getAttribute('data-counter')); const duration = 2000; const step = target / (duration / 16); let current = 0; const updateCounter = () => { current += step; if (current < target) { counter.textContent = Math.floor(current).toLocaleString(); requestAnimationFrame(updateCounter); } else { counter.textContent = target.toLocaleString(); } }; updateCounter(); }); } // Initialize tooltips function initializeTooltips() { const tooltips = document.querySelectorAll('[data-tooltip]'); tooltips.forEach(element => { element.addEventListener('mouseenter', function() { const tooltip = document.createElement('div'); tooltip.className = 'tooltip-content'; tooltip.textContent = this.getAttribute('data-tooltip'); tooltip.style.position = 'absolute'; tooltip.style.background = 'rgba(0, 0, 0, 0.9)'; tooltip.style.color = 'white'; tooltip.style.padding = '8px 12px'; tooltip.style.borderRadius = '6px'; tooltip.style.fontSize = '12px'; tooltip.style.zIndex = '1000'; tooltip.style.pointerEvents = 'none'; tooltip.style.whiteSpace = 'nowrap'; document.body.appendChild(tooltip); const rect = this.getBoundingClientRect(); tooltip.style.bottom = `${window.innerHeight - rect.top + 10}px`; tooltip.style.left = `${rect.left + (rect.width / 2) - (tooltip.offsetWidth / 2)}px`; this._tooltip = tooltip; }); element.addEventListener('mouseleave', function() { if (this._tooltip) { this._tooltip.remove(); delete this._tooltip; } }); }); } // Observe elements for scroll animations function observeElements() { const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('animate-fade-in'); observer.unobserve(entry.target); } }); }, { threshold: 0.1 }); document.querySelectorAll('.card, .glass-morphism').forEach(el => { observer.observe(el); }); } // Modal functions function openModal(modalId) { const modal = document.getElementById(modalId); if (modal) { modal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; } } function closeModal(modalId) { const modal = document.getElementById(modalId || 'boostModal'); if (modal) { modal.classList.add('hidden'); document.body.style.overflow = 'auto'; } } // Close modal on escape key document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { closeModal(); } }); // Close modal on background click document.addEventListener('click', function(e) { if (e.target.classList.contains('modal-backdrop')) { closeModal(); } }); // Dashboard specific functions function startFollowerBoost() { openModal('boostModal'); // Set default values for follower boost setTimeout(() => { const typeSelect = document.querySelector('#boostModal select'); if (typeSelect) typeSelect.value = 'Followers'; }, 100); } function startGameBoost() { openModal('boostModal'); // Set default values for game boost setTimeout(() => { const typeSelect = document.querySelector('#boostModal select'); if (typeSelect) typeSelect.value = 'Game Visits'; }, 100); } function startProfileBoost() { openModal('boostModal'); // Set default values for profile boost setTimeout(() => { const typeSelect = document.querySelector('#boostModal select'); if (typeSelect) typeSelect.value = 'Profile Views'; }, 100); } function confirmBoost() { // Get form values const type = document.querySelector('#boostModal select')?.value || 'Followers'; const amount = document.querySelector('#boostModal input')?.value || '1000'; // Show loading state const confirmBtn = event.target; const originalText = confirmBtn.textContent; confirmBtn.innerHTML = ' Processing...'; confirmBtn.disabled = true; // Simulate API call setTimeout(() => { // Reset button confirmBtn.textContent = originalText; confirmBtn.disabled = false; // Close modal closeModal(); // Show success notification showNotification(`Success! ${amount} ${type} campaign started.`, 'success'); // Update dashboard (in real app, this would be API-driven) updateDashboardStats(); }, 2000); } // Show notification function showNotification(message, type = 'success') { const notification = document.createElement('div'); notification.className = `fixed top-4 right-4 z-50 p-4 rounded-lg glass-morphism animate-fade-in flex items-center space-x-3`; const icon = type === 'success' ? 'check-circle' : 'alert-circle'; const color = type === 'success' ? 'text-green-400' : 'text-red-400'; notification.innerHTML = ` ${message} `; document.body.appendChild(notification); feather.replace(); // Remove after 3 seconds setTimeout(() => { notification.style.opacity = '0'; setTimeout(() => notification.remove(), 300); }, 3000); } // Update dashboard stats (simulated) function updateDashboardStats() { // Update follower count const followerElement = document.querySelector('[data-counter="followers"]'); if (followerElement) { const current = parseInt(followerElement.textContent.replace(/[^0-9]/g, '')); const increment = Math.floor(Math.random() * 100) + 50; followerElement.setAttribute('data-counter', current + increment); animateNumbers(); } // Add new activity const activityList = document.querySelector('.space-y-4'); if (activityList) { const newActivity = document.createElement('div'); newActivity.className = 'flex items-center space-x-4 animate-fade-in'; newActivity.innerHTML = `
New campaign started successfully
Just now