Spaces:
Running
Running
Download script.js from VZXdev/robloxboost-pro: direct link, hf CLI and curl.
- Browser
- Download file 10.5 kB
-
https://huggingface.co/spaces/VZXdev/robloxboost-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/VZXdev/robloxboost-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/VZXdev/robloxboost-pro/resolve/main/script.js
10.5 kB
| // 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 = '<span class="loading"></span> 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 = ` | |
| <i data-feather="${icon}" class="w-5 h-5 ${color}"></i> | |
| <span class="text-white">${message}</span> | |
| `; | |
| 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 = ` | |
| <div class="w-10 h-10 rounded-full bg-purple-500/20 flex items-center justify-center"> | |
| <i data-feather="zap" class="w-5 h-5 text-purple-400"></i> | |
| </div> | |
| <div class="flex-1"> | |
| <p class="text-sm"><span class="font-semibold">New campaign</span> started successfully</p> | |
| <p class="text-xs text-gray-400">Just now</p> | |
| </div> | |
| `; | |
| activityList.insertBefore(newActivity, activityList.firstChild); | |
| feather.replace(); | |
| } | |
| } | |
| // Mobile menu toggle | |
| function toggleMobileMenu() { | |
| const menu = document.querySelector('#mobile-menu'); | |
| if (menu) { | |
| menu.classList.toggle('hidden'); | |
| } | |
| } | |
| // Tab switching | |
| function switchTab(tabName) { | |
| // Hide all tabs | |
| document.querySelectorAll('.tab-content').forEach(content => { | |
| content.classList.add('hidden'); | |
| }); | |
| // Remove active class from all tabs | |
| document.querySelectorAll('.tab').forEach(tab => { | |
| tab.classList.remove('active'); | |
| }); | |
| // Show selected tab | |
| const selectedTab = document.querySelector(`[data-tab="${tabName}"]`); | |
| if (selectedTab) { | |
| selectedTab.classList.remove('hidden'); | |
| } | |
| // Add active class to clicked tab | |
| event.target.classList.add('active'); | |
| } | |
| // Form validation | |
| function validateForm(formId) { | |
| const form = document.getElementById(formId); | |
| if (!form) return false; | |
| const inputs = form.querySelectorAll('input[required], select[required]'); | |
| let isValid = true; | |
| inputs.forEach(input => { | |
| if (!input.value.trim()) { | |
| input.classList.add('border-red-500'); | |
| isValid = false; | |
| } else { | |
| input.classList.remove('border-red-500'); | |
| } | |
| }); | |
| return isValid; | |
| } | |
| // Smooth scroll to element | |
| function scrollToElement(elementId) { | |
| const element = document.getElementById(elementId); | |
| if (element) { | |
| element.scrollIntoView({ behavior: 'smooth', block: 'start' }); | |
| } | |
| } | |
| // Copy to clipboard | |
| function copyToClipboard(text) { | |
| navigator.clipboard.writeText(text).then(() => { | |
| showNotification('Copied to clipboard!', 'success'); | |
| }).catch(() => { | |
| showNotification('Failed to copy!', 'error'); | |
| }); | |
| } | |
| // Generate random ID | |
| function generateId() { | |
| return Math.random().toString(36).substr(2, 9); | |
| } | |
| // Format number with commas | |
| function formatNumber(num) { | |
| return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
| } | |
| // Format date | |
| function formatDate(date) { | |
| return new Intl.DateTimeFormat('en-US', { | |
| year: 'numeric', | |
| month: 'short', | |
| day: 'numeric', | |
| hour: '2-digit', | |
| minute: '2-digit' | |
| }).format(date); | |
| } | |
| // Debounce function | |
| function debounce(func, wait) { | |
| let timeout; | |
| return function executedFunction(...args) { | |
| const later = () => { | |
| clearTimeout(timeout); | |
| func(...args); | |
| }; | |
| clearTimeout(timeout); | |
| timeout = setTimeout(later, wait); | |
| }; | |
| } | |
| // Throttle function | |
| function throttle(func, limit) { | |
| let inThrottle; | |
| return function() { | |
| const args = arguments; | |
| const context = this; | |
| if (!inThrottle) { | |
| func.apply(context, args); | |
| inThrottle = true; | |
| setTimeout(() => inThrottle = false, limit); | |
| } | |
| }; | |
| } |