Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize any global functionality here | |
| // Example: Handle the code generation button click | |
| const generateButtons = document.querySelectorAll('button.bg-accent'); | |
| generateButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| const input = button.previousElementSibling; | |
| if (input.value.trim() !== '') { | |
| alert('Generating code based on: ' + input.value); | |
| // In a real implementation, this would call an API | |
| } | |
| }); | |
| }); | |
| // Make code language buttons interactive | |
| const langButtons = document.querySelectorAll('button.bg-gray-700'); | |
| langButtons.forEach(button => { | |
| button.addEventListener('click', () => { | |
| langButtons.forEach(btn => btn.classList.remove('bg-accent')); | |
| button.classList.add('bg-accent'); | |
| }); | |
| }); | |
| }); |