Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ const clippy = document.getElementById('clippy');
+ const chatContainer = document.getElementById('chat-container');
+ const userInput = document.getElementById('user-input');
+ const sendBtn = document.getElementById('send-btn');
+ const chatBox = document.getElementById('chat-box');
+
+ clippy.addEventListener('click', function() {
+ chatContainer.style.display = chatContainer.style.display === 'flex' ? 'none' : 'flex';
+ });
+
+ sendBtn.addEventListener('click', sendMessage);
+ userInput.addEventListener('keypress', function(e) {
+ if (e.key === 'Enter') sendMessage();
+ });
+
+ function sendMessage() {
+ const message = userInput.value.trim();
+ if (message) {
+ addMessage('user', message);
+ userInput.value = '';
+ setTimeout(() => {
+ addMessage('clippy', 'Let me think about that...');
+ }, 500);
+ }
+ }
+
+ function addMessage(sender, message) {
+ const messageDiv = document.createElement('div');
+ messageDiv.classList.add('message', sender);
+ messageDiv.textContent = message;
+ chatBox.appendChild(messageDiv);
+ chatBox.scrollTop = chatBox.scrollHeight;
+ }
+ });