Download script.js from pierreguillou/eduhtml-creator-apple-style: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/pierreguillou/eduhtml-creator-apple-style/resolve/main/script.js
- Command line
-
hf download hf://spaces/pierreguillou/eduhtml-creator-apple-style/script.js
-
curl -L -o script.js https://huggingface.co/spaces/pierreguillou/eduhtml-creator-apple-style/resolve/main/script.js
1.34 kB
| (function() { | |
| const menuBtn = document.getElementById('inlineMenuBtn'); | |
| const menu = document.getElementById('inlineMenu'); | |
| const topLink = document.getElementById('scrollTopLink'); | |
| function closeMenu() { | |
| if (!menu) return; | |
| menu.classList.remove('open'); | |
| menu.setAttribute('aria-hidden', 'true'); | |
| } | |
| if (menuBtn && menu) { | |
| menuBtn.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const isOpen = menu.classList.contains('open'); | |
| if (isOpen) { | |
| closeMenu(); | |
| } else { | |
| menu.classList.add('open'); | |
| menu.setAttribute('aria-hidden', 'false'); | |
| } | |
| }); | |
| } | |
| if (topLink) { | |
| topLink.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| window.scrollTo({ top: 0, behavior: 'smooth' }); | |
| closeMenu(); | |
| }); | |
| } | |
| // Close when clicking outside | |
| document.addEventListener('click', function(e) { | |
| if (!menu || !menuBtn) return; | |
| if (!menu.contains(e.target) && !menuBtn.contains(e.target)) { | |
| closeMenu(); | |
| } | |
| }); | |
| // Accessibility: close on Escape | |
| document.addEventListener('keydown', function(e) { | |
| if (e.key === 'Escape') closeMenu(); | |
| }); | |
| })(); |