Spaces:
Running
Running
Download script.js from SpottdLabsX23/README: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/spaces/SpottdLabsX23/README/resolve/main/script.js
- Command line
-
hf download hf://spaces/SpottdLabsX23/README/script.js
-
curl -L -o script.js https://huggingface.co/spaces/SpottdLabsX23/README/resolve/main/script.js
1.91 kB
| // Spottd micro-interactions | |
| const year = document.getElementById('year'); | |
| if (year) year.textContent = new Date().getFullYear(); | |
| const email = document.getElementById('email'); | |
| const password = document.getElementById('password'); | |
| const pwToggle = document.querySelector('.pw-toggle'); | |
| const hint = document.getElementById('domainHint'); | |
| const form = document.getElementById('loginForm'); | |
| // Gentle campus-domain nudge (non-blocking) | |
| const allowedDomains = [ | |
| 'utoronto.ca','torontomu.ca','yorku.ca','mcmaster.ca','uwaterloo.ca', | |
| 'queensu.ca','uwo.ca','uottawa.ca','algonquincollege.com','sheridancollege.ca', | |
| 'humber.ca','senecacollege.ca' | |
| ]; | |
| email?.addEventListener('input', () => { | |
| const v = email.value.toLowerCase().trim(); | |
| const domain = v.split('@')[1]; | |
| if (!domain){ hint.textContent=''; hint.className='hint'; return; } | |
| const ok = domain.endsWith('.edu') || allowedDomains.some(d => domain.endsWith(d)); | |
| hint.textContent = ok | |
| ? 'Looks good — campus email detected.' | |
| : 'Tip: use your school email for the best experience (e.g., .edu, utoronto.ca, yorku.ca).'; | |
| hint.className = 'hint ' + (ok ? 'good' : 'warn'); | |
| }); | |
| // Show/Hide password | |
| pwToggle?.addEventListener('click', () => { | |
| const show = password.type === 'password'; | |
| password.type = show ? 'text' : 'password'; | |
| pwToggle.setAttribute('aria-label', show ? 'Hide password' : 'Show password'); | |
| }); | |
| // Demo submit (replace with real auth later) | |
| form?.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const vEmail = email.value.trim(), vPw = password.value.trim(); | |
| if (!vEmail || !vPw){ alert('Please fill in both fields.'); return; } | |
| const btn = form.querySelector('.btn.primary'); | |
| const prev = btn.textContent; btn.disabled = true; btn.textContent = 'Signing in…'; | |
| setTimeout(() => { btn.disabled = false; btn.textContent = prev; alert('Demo only — connect real auth next.'); }, 900); | |
| }); | |