Download script.js from long4bttdh/code-wizard-s-wonderland: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/long4bttdh/code-wizard-s-wonderland/resolve/main/script.js
- Command line
-
hf download hf://spaces/long4bttdh/code-wizard-s-wonderland/script.js
-
curl -L -o script.js https://huggingface.co/spaces/long4bttdh/code-wizard-s-wonderland/resolve/main/script.js
1.46 kB
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize Vanta.js background | |
| VANTA.NET({ | |
| el: "#vanta-background", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| minHeight: 200.00, | |
| minWidth: 200.00, | |
| scale: 1.00, | |
| scaleMobile: 1.00, | |
| color: 0x7c3aed, | |
| backgroundColor: 0xf9fafb, | |
| points: 12.00, | |
| maxDistance: 22.00, | |
| spacing: 18.00 | |
| }); | |
| // Encoding/Decoding functions | |
| window.encodeMessage = function() { | |
| const input = document.getElementById('encode-input').value; | |
| const encoded = btoa(encodeURIComponent(input)); | |
| document.getElementById('encode-output').textContent = encoded; | |
| }; | |
| window.decodeMessage = function() { | |
| const input = document.getElementById('decode-input').value; | |
| try { | |
| const decoded = decodeURIComponent(atob(input)); | |
| document.getElementById('decode-output').textContent = decoded; | |
| } catch (e) { | |
| document.getElementById('decode-output').textContent = "Invalid encoded message"; | |
| } | |
| }; | |
| // 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' | |
| }); | |
| }); | |
| }); | |
| }); |