Spaces:
Running
Running
File size: 10,499 Bytes
d8c4e8f 7251d98 6491e54 d8c4e8f 6491e54 d8c4e8f 7251d98 d8c4e8f 7251d98 d8c4e8f 6491e54 d8c4e8f 7251d98 d8c4e8f 6491e54 7251d98 6491e54 7251d98 6491e54 d8c4e8f | 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 | // Page load animations
window.addEventListener('load', () => {
setTimeout(() => {
document.getElementById('loader').style.display = 'none';
}, 1500);
// Animate counters
const counters = document.querySelectorAll('.counter');
const speed = 200;
counters.forEach(counter => {
const animate = () => {
const value = +counter.getAttribute('data-target');
const data = +counter.innerText;
const time = value / speed;
if (data < value) {
counter.innerText = Math.ceil(data + time);
setTimeout(animate, 10);
} else {
counter.innerText = value.toLocaleString();
}
}
animate();
});
});
// Smooth scroll to section
function scrollToSection(sectionId) {
const section = document.getElementById(sectionId);
if (section) {
section.scrollIntoView({ behavior: 'smooth' });
}
}
// Investment plan selection
let selectedPlanData = {};
let userInvestments = [];
function selectPlan(plan, daily, withdrawal, fixedAmount) {
selectedPlanData = { plan, daily, withdrawal, amount: fixedAmount };
document.getElementById('modalPlan').value = `${plan} Plan - ${daily} daily - Fixed ${fixedAmount}`;
document.getElementById('modalAmount').value = fixedAmount;
document.getElementById('modalAmount').readOnly = true;
document.getElementById('investModal').classList.remove('hidden');
document.getElementById('investModal').classList.add('flex');
document.body.style.overflow = 'hidden';
}
// Smooth scrolling for anchor links
document.addEventListener('DOMContentLoaded', function() {
const links = document.querySelectorAll('a[href^="#"]');
links.forEach(link => {
link.addEventListener('click', function(e) {
const href = this.getAttribute('href');
if (href !== '#') {
e.preventDefault();
const target = document.querySelector(href);
if (target) {
const offsetTop = target.offsetTop - 80; // Account for fixed navbar
window.scrollTo({
top: offsetTop,
behavior: 'smooth'
});
}
}
});
});
});
function closeInvestModal() {
document.getElementById('investModal').classList.add('hidden');
document.getElementById('investModal').classList.remove('flex');
document.body.style.overflow = 'auto';
}
function confirmInvestment() {
const amount = document.getElementById('modalAmount').value;
const wallet = document.getElementById('modalWallet').value;
if (!amount || !wallet) {
showNotification('Please fill in all fields', 'error');
return;
}
// Check if amount matches the fixed amount for the plan
const fixedAmounts = {
'Starter': 10,
'Professional': 100,
'VIP': 1000
};
if (parseFloat(amount) !== fixedAmounts[selectedPlanData.plan]) {
showNotification(`For ${selectedPlanData.plan} plan, the investment amount must be exactly ${fixedAmounts[selectedPlanData.plan]}`, 'error');
return;
}
// Add investment to user's portfolio
const investment = {
plan: selectedPlanData.plan,
amount: parseFloat(amount),
daily: selectedPlanData.daily,
withdrawal: selectedPlanData.withdrawal,
wallet: wallet,
startDate: new Date().toISOString(),
id: Date.now()
};
userInvestments.push(investment);
localStorage.setItem('userInvestments', JSON.stringify(userInvestments));
showNotification(`Investment of ${amount} confirmed for ${selectedPlanData.plan} plan! You can purchase additional plans if desired.`, 'success');
closeInvestModal();
// Reset form
document.getElementById('modalAmount').value = '';
document.getElementById('modalWallet').value = '';
document.getElementById('modalAmount').readOnly = false;
}
// Load user investments on page load
window.addEventListener('load', () => {
const saved = localStorage.getItem('userInvestments');
if (saved) {
userInvestments = JSON.parse(saved);
}
});
// Calculator functionality
function calculateReturns() {
const amount = parseFloat(document.getElementById('calcAmount').value) || 0;
const daily = 1; // Fixed at 1%
const days = parseInt(document.getElementById('calcDays').value) || 0;
const compound = document.getElementById('calcCompound').value;
if (!amount || !days) {
showNotification('Please enter investment amount and period', 'error');
return;
}
let totalReturn;
if (compound === 'daily') {
totalReturn = amount * Math.pow(1 + (daily / 100), days);
} else {
totalReturn = amount + (amount * (daily / 100) * days);
}
const netProfit = totalReturn - amount;
document.getElementById('totalReturn').textContent = totalReturn.toFixed(2).toLocaleString();
document.getElementById('netProfit').textContent = netProfit.toFixed(2).toLocaleString();
document.getElementById('calcResults').classList.remove('hidden');
}
// FAQ toggle
function toggleFAQ(id) {
const content = document.getElementById(`faq-${id}`);
const icon = document.getElementById(`faq-icon-${id}`);
if (content.classList.contains('hidden')) {
content.classList.remove('hidden');
icon.style.transform = 'rotate(180deg)';
} else {
content.classList.add('hidden');
icon.style.transform = 'rotate(0deg)';
}
}
// Registration modal
function showRegistration() {
document.getElementById('regModal').classList.remove('hidden');
document.getElementById('regModal').classList.add('flex');
document.body.style.overflow = 'hidden';
}
function closeRegModal() {
document.getElementById('regModal').classList.add('hidden');
document.getElementById('regModal').classList.remove('flex');
document.body.style.overflow = 'auto';
}
function handleRegistration(event) {
event.preventDefault();
const formData = new FormData(event.target);
showNotification('Account created successfully! Check your email for verification.', 'success');
closeRegModal();
event.target.reset();
}
// Login modal
function showLogin() {
const loginModal = document.querySelector('login-modal');
if (loginModal) {
const overlay = loginModal.shadowRoot.getElementById('loginModal');
if (overlay) {
overlay.style.display = 'flex';
document.body.style.overflow = 'hidden';
}
}
}
function closeLoginModal() {
const loginModal = document.querySelector('login-modal');
if (loginModal) {
const overlay = loginModal.shadowRoot.getElementById('loginModal');
if (overlay) {
overlay.style.display = 'none';
document.body.style.overflow = 'auto';
}
}
}
function handleLogin(event) {
event.preventDefault();
showNotification('Login successful! Welcome back.', 'success');
closeLoginModal();
event.target.reset();
}
// Notification system
function showNotification(message, type = 'info') {
const notification = document.createElement('div');
notification.className = `fixed top-4 right-4 z-50 px-6 py-4 rounded-lg shadow-lg transform transition-all duration-500 ${
type === 'success' ? 'bg-green-500' :
type === 'error' ? 'bg-red-500' :
type === 'warning' ? 'bg-yellow-500' : 'bg-blue-500'
} text-white`;
notification.innerHTML = `
<div class="flex items-center gap-3">
<i data-feather="${
type === 'success' ? 'check-circle' :
type === 'error' ? 'x-circle' :
type === 'warning' ? 'alert-triangle' : 'info'
}" class="w-5 h-5"></i>
<span>${message}</span>
</div>
`;
document.body.appendChild(notification);
feather.replace();
setTimeout(() => {
notification.style.transform = 'translateX(400px)';
setTimeout(() => notification.remove(), 500);
}, 3000);
}
// Live ticker simulation
function updateLiveTicker() {
const tickers = document.querySelectorAll('.live-ticker');
tickers.forEach(ticker => {
const currentValue = parseFloat(ticker.textContent.replace(/[^0-9.-]/g, ''));
const change = (Math.random() - 0.5) * 2;
const newValue = currentValue + change;
ticker.textContent = newValue.toFixed(2) + '%';
ticker.className = `live-ticker ${change > 0 ? 'text-green-500' : 'text-red-500'}`;
});
}
// Simulate live data updates
setInterval(() => {
// Update random stats
const statElements = document.querySelectorAll('.live-stat');
if (statElements.length > 0) {
const randomStat = statElements[Math.floor(Math.random() * statElements.length)];
const current = parseInt(randomStat.textContent.replace(/[^0-9]/g, ''));
randomStat.textContent = (current + Math.floor(Math.random() * 10)).toLocaleString();
}
}, 5000);
// Add parallax effect on scroll
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const parallaxElements = document.querySelectorAll('.parallax');
parallaxElements.forEach(element => {
const speed = element.dataset.speed || 0.5;
element.style.transform = `translateY(${scrolled * speed}px)`;
});
});
// Form validation enhancements
document.querySelectorAll('input[type="number"]').forEach(input => {
input.addEventListener('input', function() {
if (this.value < 0) this.value = 0;
if (this.value > 9999999) this.value = 9999999;
});
});
// Add ripple effect to buttons
document.querySelectorAll('button').forEach(button => {
button.addEventListener('click', function(e) {
const ripple = document.createElement('span');
ripple.className = 'absolute bg-white opacity-30 rounded-full animate-ping';
ripple.style.width = ripple.style.height = '20px';
ripple.style.left = e.offsetX - 10 + 'px';
ripple.style.top = e.offsetY - 10 + 'px';
this.style.position = 'relative';
this.style.overflow = 'hidden';
this.appendChild(ripple);
setTimeout(() => ripple.remove(), 600);
});
}); |