Spaces:
Running
Running
make a website for giveaway that choose a random comment from and instagram link video or post and that is designed like IOS 26 with an about section and a contact me section
0d453b8 verified Download script.js from D3faultnull/instapicker-pro: direct link, hf CLI and curl.
- Browser
- Download file 2.29 kB
-
https://huggingface.co/spaces/D3faultnull/instapicker-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/D3faultnull/instapicker-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/D3faultnull/instapicker-pro/resolve/main/script.js
2.29 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| const fetchBtn = document.getElementById('fetch-btn'); | |
| const instagramUrl = document.getElementById('instagram-url'); | |
| const loading = document.getElementById('loading'); | |
| const results = document.getElementById('results'); | |
| const winner = document.getElementById('winner'); | |
| const participants = document.getElementById('participants'); | |
| const pickAgain = document.getElementById('pick-again'); | |
| // Mock data for demonstration | |
| const mockParticipants = [ | |
| "@user123", "@giveawaylover", "@instafan", "@shopaholic", | |
| "@fitnessguru", "@travelbug", "@foodieforever", "@techgeek", | |
| "@fashionista", "@bookworm", "@petlover", "@musicfan", | |
| "@artistlife", "@photographypro", "@entrepreneur", "@studentlife" | |
| ]; | |
| fetchBtn.addEventListener('click', function() { | |
| if (!instagramUrl.value) { | |
| alert('Please enter an Instagram post URL'); | |
| return; | |
| } | |
| // Show loading state | |
| loading.classList.remove('hidden'); | |
| results.classList.add('hidden'); | |
| // Simulate API call with timeout | |
| setTimeout(() => { | |
| loading.classList.add('hidden'); | |
| results.classList.remove('hidden'); | |
| // Display all participants | |
| participants.innerHTML = ''; | |
| mockParticipants.forEach(participant => { | |
| const p = document.createElement('p'); | |
| p.textContent = participant; | |
| p.className = 'py-1 border-b border-gray-100 last:border-0'; | |
| participants.appendChild(p); | |
| }); | |
| // Pick a random winner | |
| pickRandomWinner(); | |
| }, 2000); | |
| }); | |
| pickAgain.addEventListener('click', pickRandomWinner); | |
| function pickRandomWinner() { | |
| // Reset animation | |
| winner.classList.remove('winner-pulse'); | |
| // Force reflow to restart animation | |
| void winner.offsetWidth; | |
| // Pick random winner | |
| const randomIndex = Math.floor(Math.random() * mockParticipants.length); | |
| winner.textContent = mockParticipants[randomIndex]; | |
| // Add animation | |
| winner.classList.add('winner-pulse'); | |
| } | |
| }); |