Download script.js from Mira2805/pixelpulse-gallery-explorer: direct link, hf CLI and curl.
- Browser
- Download file 1.82 kB
-
https://huggingface.co/spaces/Mira2805/pixelpulse-gallery-explorer/resolve/main/script.js
- Command line
-
hf download hf://spaces/Mira2805/pixelpulse-gallery-explorer/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Mira2805/pixelpulse-gallery-explorer/resolve/main/script.js
1.82 kB
| // Shared JavaScript across all pages | |
| document.addEventListener('DOMContentLoaded', () => { | |
| console.log('PixelPulse Gallery Explorer loaded!'); | |
| // Add animation classes to sections when they come into view | |
| const sections = document.querySelectorAll('section'); | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('animate-fadeIn'); | |
| observer.unobserve(entry.target); | |
| } | |
| }); | |
| }, { threshold: 0.1 }); | |
| sections.forEach((section, index) => { | |
| section.style.opacity = '0'; | |
| section.classList.add(`delay-${(index % 6) * 100}`); | |
| observer.observe(section); | |
| }); | |
| // Like button functionality | |
| document.addEventListener('click', (e) => { | |
| if (e.target.closest('[data-feather="heart"]')) { | |
| const heart = e.target.closest('[data-feather="heart"]'); | |
| const parentCard = heart.closest('.card-hover'); | |
| if (heart.classList.contains('text-purple-600')) { | |
| heart.classList.remove('text-purple-600'); | |
| heart.classList.add('text-red-500'); | |
| parentCard.classList.add('ring-2', 'ring-red-300'); | |
| // Temporary animation | |
| parentCard.style.transform = 'scale(1.05)'; | |
| setTimeout(() => { | |
| parentCard.style.transform = ''; | |
| }, 300); | |
| } else { | |
| heart.classList.add('text-purple-600'); | |
| heart.classList.remove('text-red-500'); | |
| parentCard.classList.remove('ring-2', 'ring-red-300'); | |
| } | |
| feather.replace(); | |
| } | |
| }); | |
| }); |