Download script.js from Mucella/pixelpulse-palette-explorer: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/spaces/Mucella/pixelpulse-palette-explorer/resolve/main/script.js
- Command line
-
hf download hf://spaces/Mucella/pixelpulse-palette-explorer/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Mucella/pixelpulse-palette-explorer/resolve/main/script.js
1.05 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips for color swatches | |
| const colorSwatches = document.querySelectorAll('.color-swatch'); | |
| colorSwatches.forEach(swatch => { | |
| const color = swatch.style.backgroundColor; | |
| swatch.setAttribute('title', color); | |
| swatch.addEventListener('click', function() { | |
| navigator.clipboard.writeText(color).then(() => { | |
| const originalText = swatch.textContent; | |
| swatch.textContent = 'Copied!'; | |
| setTimeout(() => { | |
| swatch.textContent = originalText; | |
| }, 2000); | |
| }); | |
| }); | |
| }); | |
| // Smooth scroll for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| }); |