Download script.js from Abmacode12/codepulse-coding-space-hub: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/spaces/Abmacode12/codepulse-coding-space-hub/resolve/main/script.js
- Command line
-
hf download hf://spaces/Abmacode12/codepulse-coding-space-hub/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Abmacode12/codepulse-coding-space-hub/resolve/main/script.js
2.19 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Search functionality for sidebar | |
| const searchInput = document.querySelector('.search-input input'); | |
| const navItems = document.querySelectorAll('.nav-item'); | |
| searchInput.addEventListener('input', function() { | |
| const searchTerm = this.value.toLowerCase(); | |
| navItems.forEach(item => { | |
| const label = item.querySelector('.nav-label').textContent.toLowerCase(); | |
| if (label.includes(searchTerm)) { | |
| item.style.display = 'flex'; | |
| } else { | |
| item.style.display = 'none'; | |
| } | |
| }); | |
| }); | |
| // Active state for nav items | |
| navItems.forEach(item => { | |
| item.addEventListener('click', function() { | |
| navItems.forEach(i => i.classList.remove('active')); | |
| this.classList.add('active'); | |
| }); | |
| }); | |
| // Input bar functionality | |
| const messageInput = document.querySelector('.text-input input'); | |
| const sendBtn = document.querySelector('.send-btn'); | |
| function updateSendButton() { | |
| sendBtn.disabled = messageInput.value.trim() === ''; | |
| } | |
| messageInput.addEventListener('input', updateSendButton); | |
| messageInput.addEventListener('keydown', function(e) { | |
| if (e.key === 'Enter' && !sendBtn.disabled) { | |
| e.preventDefault(); | |
| // Here you would handle sending the message | |
| console.log('Message sent:', this.value); | |
| this.value = ''; | |
| updateSendButton(); | |
| } | |
| }); | |
| sendBtn.addEventListener('click', function() { | |
| if (!this.disabled) { | |
| // Here you would handle sending the message | |
| console.log('Message sent:', messageInput.value); | |
| messageInput.value = ''; | |
| updateSendButton(); | |
| } | |
| }); | |
| // Microphone button placeholder | |
| const micBtn = document.querySelector('.input-btn:nth-child(3)'); | |
| micBtn.addEventListener('click', function() { | |
| alert('Microphone functionality would be implemented here'); | |
| }); | |
| // Initialize | |
| updateSendButton(); | |
| feather.replace(); | |
| }); |