Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const assistant = document.getElementById('assistant');
+ const toggleBtn = document.getElementById('toggle-assistant');
+ const sendBtn = document.getElementById('send-btn');
+ const userInput = document.getElementById('user-input');
+ const assistantText = document.getElementById('assistant-text');
+
+ const responses = [
+ "I see you're trying to have a conversation! Need any help?",
+ "That's interesting! Tell me more about it.",
+ "I'm here to assist you, even though I'm not the original Clippy!",
+ "Have you tried turning it off and on again? Just kidding!",
+ "That's a great question! Let me think about it...",
+ "I'm not as annoying as the original Clippy, I promise!",
+ ];
+
+ toggleBtn.addEventListener('click', () => {
+ assistant.classList.toggle('hidden');
+ });
+
+ const sendMessage = () => {
+ const message = userInput.value.trim();
+ if (message) {
+ const response = responses[Math.floor(Math.random() * responses.length)];
+ assistantText.textContent = response;
+ userInput.value = '';
+ }
+ };
+
+ sendBtn.addEventListener('click', sendMessage);
+ userInput.addEventListener('keypress', (e) => {
+ if (e.key === 'Enter') {
+ sendMessage();
+ }
+ });
+
+ // Animate character periodically
+ setInterval(() => {
+ const character = document.querySelector('.assistant-character');
+ character.style.transform = 'translateY(-5px)';
+ setTimeout(() => {
+ character.style.transform = 'translateY(0)';
+ }, 200);
+ }, 5000);
+ });