Download script.js from djpitsch/turntable-tango-request-hub: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/djpitsch/turntable-tango-request-hub/resolve/main/script.js
- Command line
-
hf download hf://spaces/djpitsch/turntable-tango-request-hub/script.js
-
curl -L -o script.js https://huggingface.co/spaces/djpitsch/turntable-tango-request-hub/resolve/main/script.js
1.08 kB
| // Listen for song requests and store them | |
| document.addEventListener('songRequested', (e) => { | |
| const request = e.detail; | |
| let requests = JSON.parse(localStorage.getItem('songRequests') || '[]'); | |
| requests.unshift(request); // Add new request at beginning | |
| localStorage.setItem('songRequests', JSON.stringify(requests)); | |
| // Update the recent requests display if on home page | |
| if (window.location.pathname === '/index.html' || window.location.pathname === '/') { | |
| const container = document.getElementById('recentRequests'); | |
| if (container) { | |
| if (container.querySelector('p')) { | |
| container.innerHTML = ''; | |
| } | |
| const card = document.createElement('request-card'); | |
| card.setAttribute('name', request.name); | |
| card.setAttribute('song', request.song); | |
| card.setAttribute('artist', request.artist); | |
| if (request.message) card.setAttribute('message', request.message); | |
| card.setAttribute('timestamp', request.timestamp); | |
| card.setAttribute('status', request.status); | |
| container.prepend(card); | |
| } | |
| } | |
| }); | |