Spaces:
Running
Running
Download script.js from hemoyt/codecraft-ai-wizard: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/hemoyt/codecraft-ai-wizard/resolve/main/script.js
- Command line
-
hf download hf://spaces/hemoyt/codecraft-ai-wizard/script.js
-
curl -L -o script.js https://huggingface.co/spaces/hemoyt/codecraft-ai-wizard/resolve/main/script.js
1.29 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips | |
| const tooltipTriggers = document.querySelectorAll('[data-tooltip]'); | |
| tooltipTriggers.forEach(trigger => { | |
| const tooltip = document.createElement('div'); | |
| tooltip.className = 'tooltip hidden absolute z-10 bg-gray-800 text-white text-xs rounded py-1 px-2'; | |
| tooltip.textContent = trigger.getAttribute('data-tooltip'); | |
| trigger.appendChild(tooltip); | |
| trigger.addEventListener('mouseenter', () => { | |
| tooltip.classList.remove('hidden'); | |
| }); | |
| trigger.addEventListener('mouseleave', () => { | |
| tooltip.classList.add('hidden'); | |
| }); | |
| }); | |
| // 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' | |
| }); | |
| }); | |
| }); | |
| }); | |
| // Dark mode toggle (if implemented) | |
| function toggleDarkMode() { | |
| document.documentElement.classList.toggle('dark'); | |
| localStorage.setItem('darkMode', document.documentElement.classList.contains('dark')); | |
| } |