Download script.js from Myfake1103/neuronpulse-gpu-infinity: direct link, hf CLI and curl.
- Browser
- Download file 8.44 kB
-
https://huggingface.co/spaces/Myfake1103/neuronpulse-gpu-infinity/resolve/main/script.js
- Command line
-
hf download hf://spaces/Myfake1103/neuronpulse-gpu-infinity/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Myfake1103/neuronpulse-gpu-infinity/resolve/main/script.js
8.44 kB
| // Main JavaScript for NeuronPulse | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize all the features | |
| initCounterAnimation(); | |
| initNavScroll(); | |
| initScrollReveal(); | |
| initParticles(); | |
| initFormValidation(); | |
| }); | |
| // Counter animation for stats | |
| function initCounterAnimation() { | |
| const counters = document.querySelectorAll('[data-counter]'); | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| const counter = entry.target; | |
| const target = parseInt(counter.dataset.counter); | |
| const increment = target / 100; | |
| let current = 0; | |
| const updateCounter = () => { | |
| current += increment; | |
| if (current < target) { | |
| counter.textContent = Math.floor(current).toLocaleString(); | |
| requestAnimationFrame(updateCounter); | |
| } else { | |
| counter.textContent = target.toLocaleString(); | |
| } | |
| }; | |
| updateCounter(); | |
| observer.unobserve(counter); | |
| } | |
| }); | |
| }); | |
| counters.forEach(counter => observer.observe(counter)); | |
| } | |
| // Navigation scroll effect | |
| function initNavScroll() { | |
| const nav = document.querySelector('nav'); | |
| if (nav) { | |
| window.addEventListener('scroll', () => { | |
| if (window.scrollY > 100) { | |
| nav.classList.add('bg-white/95', 'backdrop-blur-sm', 'shadow-lg'); | |
| } else { | |
| nav.classList.remove('bg-white/95', 'backdrop-blur-sm', 'shadow-lg'); | |
| } | |
| }); | |
| } | |
| } | |
| // Scroll reveal animation | |
| function initScrollReveal() { | |
| const elements = document.querySelectorAll('.reveal'); | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.style.opacity = '1'; | |
| entry.target.style.transform = 'translateY(0)'; | |
| observer.unobserve(entry.target); | |
| } | |
| }); | |
| }); | |
| elements.forEach(element => { | |
| element.style.opacity = '0'; | |
| element.style.transform = 'translateY(30px)'; | |
| element.style.transition = 'all 0.6s ease'; | |
| observer.observe(element); | |
| }); | |
| } | |
| // Particle background effect | |
| function initParticles() { | |
| const canvas = document.createElement('canvas'); | |
| const ctx = canvas.getContext('2d'); | |
| canvas.style.position = 'fixed'; | |
| canvas.style.top = '0'; | |
| canvas.style.left = '0'; | |
| canvas.style.zIndex = '-1'; | |
| canvas.style.pointerEvents = 'none'; | |
| document.body.appendChild(canvas); | |
| function resizeCanvas() { | |
| canvas.width = window.innerWidth; | |
| canvas.height = window.innerHeight; | |
| } | |
| resizeCanvas(); | |
| const particles = []; | |
| const particleCount = 100; | |
| class Particle { | |
| constructor() { | |
| this.x = Math.random() * canvas.width; | |
| this.y = Math.random() * canvas.height; | |
| this.vx = (Math.random() - 0.5) * 0.5; | |
| this.vy = (Math.random() - 0.5) * 0.5; | |
| this.radius = Math.random() * 2 + 1; | |
| this.opacity = Math.random() * 0.5 + 0.2; | |
| } | |
| update() { | |
| this.x += this.vx; | |
| this.y += this.vy; | |
| if (this.x < 0 || this.x > canvas.width) this.vx *= -1; | |
| if (this.y < 0 || this.y > canvas.height) this.vy *= -1; | |
| } | |
| draw() { | |
| ctx.beginPath(); | |
| ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2); | |
| ctx.fillStyle = `rgba(124, 58, 237, ${this.opacity})`; | |
| ctx.fill(); | |
| } | |
| } | |
| // Initialize particles | |
| for (let i = 0; i < particleCount; i++) { | |
| particles.push(new Particle()); | |
| } | |
| function animateParticles() { | |
| ctx.clearRect(0, 0, canvas.width, canvas.height); | |
| particles.forEach(particle => { | |
| particle.update(); | |
| particle.draw(); | |
| }); | |
| // Draw connections | |
| particles.forEach((p1, i) => { | |
| particles.slice(i + 1).forEach(p2 => { | |
| const distance = Math.sqrt( | |
| Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2) | |
| ); | |
| if (distance < 100) { | |
| ctx.beginPath(); | |
| ctx.moveTo(p1.x, p1.y); | |
| ctx.lineTo(p2.x, p2.y); | |
| ctx.strokeStyle = `rgba(124, 58, 237, ${0.2 * (1 - distance / 100)})`; | |
| ctx.stroke(); | |
| } | |
| }); | |
| }); | |
| requestAnimationFrame(animateParticles); | |
| } | |
| window.addEventListener('resize', resizeCanvas); | |
| animateParticles(); | |
| } | |
| // Form validation | |
| function initFormValidation() { | |
| const forms = document.querySelectorAll('form'); | |
| forms.forEach(form => { | |
| form.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const inputs = form.querySelectorAll('input[required], textarea[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'); | |
| } | |
| }); | |
| if (isValid) { | |
| // Simulate form submission | |
| const button = form.querySelector('button[type="submit"]'); | |
| const originalText = button.textContent; | |
| button.textContent = 'Sending...'; | |
| button.disabled = true; | |
| setTimeout(() => { | |
| button.textContent = 'Sent!'; | |
| button.classList.add('bg-green-600', 'hover:bg-green-700'); | |
| setTimeout(() => { | |
| button.textContent = originalText; | |
| button.disabled = false; | |
| button.classList.remove('bg-green-600', 'hover:bg-green-700'); | |
| form.reset(); | |
| }, 2000); | |
| }, 1500); | |
| } | |
| }); | |
| }); | |
| } | |
| // Mobile menu toggle | |
| function toggleMobileMenu() { | |
| const mobileMenu = document.querySelector('#mobile-menu'); | |
| if (mobileMenu) { | |
| mobileMenu.classList.toggle('hidden'); | |
| } | |
| } | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| const target = document.querySelector(this.getAttribute('href')); | |
| if (target) { | |
| target.scrollIntoView({ | |
| behavior: 'smooth', | |
| block: 'start' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Add page transition effect | |
| document.querySelectorAll('a').forEach(link => { | |
| if (link.hostname === window.location.hostname && link.href !== 'javascript:void(0)') { | |
| link.addEventListener('click', (e) => { | |
| document.body.style.opacity = '0.8'; | |
| document.body.style.transition = 'opacity 0.3s ease'; | |
| setTimeout(() => { | |
| document.body.style.opacity = '1'; | |
| }, 300); | |
| }); | |
| } | |
| }); | |
| // Loading animation for server cards | |
| window.addEventListener('load', () => { | |
| setTimeout(() => { | |
| document.querySelectorAll('.server-card').forEach((card, index) => { | |
| setTimeout(() => { | |
| card.style.opacity = '1'; | |
| card.style.transform = 'translateY(0)'; | |
| }, index * 100); | |
| }); | |
| }, 100); | |
| }); | |
| // Prevent right click on images | |
| document.addEventListener('contextmenu', (e) => { | |
| if (e.target.tagName === 'IMG') { | |
| e.preventDefault(); | |
| } | |
| }); | |
| // Console easter egg | |
| console.log('%c๐ NeuronPulse - GPU Infinity', 'font-size: 20px; color: #7c3aed; font-weight: bold;'); | |
| console.log('%cPowered by Innovation ๐ฎ', 'font-size: 14px; color: #6d28d9;'); | |
| console.log('%cReady to Launch Your Ideas to Space! ๐', 'font-size: 14px; color: #5b21b6;'); |