// ... (all your other code below remains unchanged) ... } // // ==================== NEW generateResponse FUNCTION ENDS HERE ==================== // function copyToClipboard() { const outputArea = document.getElementById('outputArea'); const selection = window.getSelection(); const range = document.createRange(); range.selectNodeContents(outputArea); selection.removeAllRanges(); selection.addRange(range); document.execCommand('copy'); alert('Text copied to clipboard!'); } // Clear screen on long left mouse button hold let mouseDownTimer; document.addEventListener('mousedown', (event) => { if (event.button === 0) { // Left mouse button mouseDownTimer = setTimeout(() => { document.getElementById('inputArea').value = ''; document.getElementById('outputArea').innerHTML = ''; }, 2000); // 2 seconds } }); document.addEventListener('mouseup', () => { clearTimeout(mouseDownTimer); }); document.addEventListener('mouseleave', () => { clearTimeout(mouseDownTimer); });