Download script.js from Nomatter/deepsite-diy-install-wizard: direct link, hf CLI and curl.
- Browser
- Download file 2.14 kB
-
https://huggingface.co/spaces/Nomatter/deepsite-diy-install-wizard/resolve/main/script.js
- Command line
-
hf download hf://spaces/Nomatter/deepsite-diy-install-wizard/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Nomatter/deepsite-diy-install-wizard/resolve/main/script.js
2.14 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Copy code blocks to clipboard | |
| document.querySelectorAll('.code-block').forEach(block => { | |
| const copyButton = document.createElement('button'); | |
| copyButton.innerHTML = '<i data-feather="copy" class="w-4 h-4"></i>'; | |
| copyButton.className = 'absolute top-2 right-2 p-1 rounded bg-gray-700 hover:bg-gray-600 text-gray-200'; | |
| copyButton.title = 'Copy to clipboard'; | |
| const header = block.querySelector('.code-header'); | |
| if (header) { | |
| header.style.position = 'relative'; | |
| header.appendChild(copyButton); | |
| copyButton.addEventListener('click', () => { | |
| const code = block.querySelector('.code-content').textContent; | |
| navigator.clipboard.writeText(code).then(() => { | |
| copyButton.innerHTML = '<i data-feather="check" class="w-4 h-4"></i>'; | |
| setTimeout(() => { | |
| copyButton.innerHTML = '<i data-feather="copy" class="w-4 h-4"></i>'; | |
| feather.replace(); | |
| }, 2000); | |
| }); | |
| }); | |
| } | |
| }); | |
| // Highlight current step in viewport | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| document.querySelectorAll('.step-card').forEach(card => { | |
| card.classList.remove('border-blue-500', 'bg-blue-50'); | |
| }); | |
| entry.target.classList.add('border-blue-500', 'bg-blue-50'); | |
| } | |
| }); | |
| }, { threshold: 0.1 }); | |
| document.querySelectorAll('.step-card').forEach(card => { | |
| observer.observe(card); | |
| }); | |
| }); |