Spaces:
Running
Running
File size: 10,463 Bytes
115ecdf | 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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | // 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);
}
};
} |