diff --git a/index.html b/index.html index 705ce2a..7807735 100644 --- a/index.html +++ b/index.html @@ -244,25 +244,12 @@ Attach File - - -
@@ -422,25 +409,12 @@ Attach File - - -
@@ -1430,7 +1404,6 @@ document.getElementById('conversationImageInput').value = ''; document.getElementById('conversationVideoInput').value = ''; document.getElementById('conversationFileInput').value = ''; - document.getElementById('conversationCameraInput').value = ''; renderConversationAttachmentsList(); } @@ -1738,7 +1711,6 @@ const imageInput = document.getElementById('imageInput'); const videoInput = document.getElementById('videoInput'); const fileInput = document.getElementById('fileInput'); - const cameraInput = document.getElementById('cameraInput'); attachmentMenuBtn.addEventListener('click', (e) => { e.preventDefault(); @@ -1760,70 +1732,8 @@ fileInput.click(); }); - document.getElementById('takePictureBtn').addEventListener('click', () => { - attachmentMenu.classList.add('hidden'); - cameraInput.click(); - }); - - document.getElementById('recordVideoBtn').addEventListener('click', async () => { - attachmentMenu.classList.add('hidden'); - try { - const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true }); - const videoRecorder = new MediaRecorder(stream); - const chunks = []; - - videoRecorder.ondataavailable = (e) => { - if (e.data.size > 0) chunks.push(e.data); - }; - - videoRecorder.onstop = () => { - const blob = new Blob(chunks, { type: 'video/webm' }); - const file = new File([blob], `video-${Date.now()}.webm`, { type: 'video/webm' }); - pendingNoteAttachments.push(file); - renderNoteAttachmentsList(); - stream.getTracks().forEach(track => track.stop()); - }; - - videoRecorder.start(); - - // Show recording UI - const recordStatus = document.getElementById('recordStatus'); - const originalStatus = recordStatus.textContent; - recordStatus.textContent = 'Recording video... (Click to stop)'; - recordStatus.style.cursor = 'pointer'; - recordStatus.style.color = '#dc2626'; - - const stopHandler = () => { - recordStatus.removeEventListener('click', stopHandler); - videoRecorder.stop(); - recordStatus.textContent = originalStatus; - recordStatus.style.cursor = 'auto'; - recordStatus.style.color = ''; - }; - - recordStatus.addEventListener('click', stopHandler); - - // Auto-stop after 5 minutes - setTimeout(() => { - if (videoRecorder.state === 'recording') { - recordStatus.removeEventListener('click', stopHandler); - videoRecorder.stop(); - recordStatus.textContent = 'Video recording stopped (5 minute limit)'; - recordStatus.style.cursor = 'auto'; - setTimeout(() => { - recordStatus.textContent = originalStatus; - recordStatus.style.color = ''; - }, 3000); - } - }, 5 * 60 * 1000); - } catch (err) { - console.error('Failed to access camera/microphone:', err); - alert('Unable to access camera or microphone. Check permissions.'); - } - }); - // File input change handlers - [imageInput, videoInput, fileInput, cameraInput].forEach(input => { + [imageInput, videoInput, fileInput].forEach(input => { input.addEventListener('change', (e) => { pendingNoteAttachments.push(...Array.from(e.target.files || [])); renderNoteAttachmentsList(); @@ -1836,7 +1746,6 @@ imageInput.value = ''; videoInput.value = ''; fileInput.value = ''; - cameraInput.value = ''; renderNoteAttachmentsList(); }); @@ -1853,7 +1762,6 @@ const conversationImageInput = document.getElementById('conversationImageInput'); const conversationVideoInput = document.getElementById('conversationVideoInput'); const conversationFileInput = document.getElementById('conversationFileInput'); - const conversationCameraInput = document.getElementById('conversationCameraInput'); conversationAttachmentMenuBtn.addEventListener('click', (e) => { e.preventDefault(); @@ -1875,70 +1783,8 @@ conversationFileInput.click(); }); - document.getElementById('conversationTakePictureBtn').addEventListener('click', () => { - conversationAttachmentMenu.classList.add('hidden'); - conversationCameraInput.click(); - }); - - document.getElementById('conversationRecordVideoBtn').addEventListener('click', async () => { - conversationAttachmentMenu.classList.add('hidden'); - try { - const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true }); - const videoRecorder = new MediaRecorder(stream); - const chunks = []; - - videoRecorder.ondataavailable = (e) => { - if (e.data.size > 0) chunks.push(e.data); - }; - - videoRecorder.onstop = () => { - const blob = new Blob(chunks, { type: 'video/webm' }); - const file = new File([blob], `video-${Date.now()}.webm`, { type: 'video/webm' }); - pendingConversationAttachments.push(file); - renderConversationAttachmentsList(); - stream.getTracks().forEach(track => track.stop()); - }; - - videoRecorder.start(); - - // Show recording UI - const recordStatus = document.getElementById('conversationRecordStatus'); - const originalStatus = recordStatus.textContent; - recordStatus.textContent = 'Recording video... (Click to stop)'; - recordStatus.style.cursor = 'pointer'; - recordStatus.style.color = '#dc2626'; - - const stopHandler = () => { - recordStatus.removeEventListener('click', stopHandler); - videoRecorder.stop(); - recordStatus.textContent = originalStatus; - recordStatus.style.cursor = 'auto'; - recordStatus.style.color = ''; - }; - - recordStatus.addEventListener('click', stopHandler); - - // Auto-stop after 5 minutes - setTimeout(() => { - if (videoRecorder.state === 'recording') { - recordStatus.removeEventListener('click', stopHandler); - videoRecorder.stop(); - recordStatus.textContent = 'Video recording stopped (5 minute limit)'; - recordStatus.style.cursor = 'auto'; - setTimeout(() => { - recordStatus.textContent = originalStatus; - recordStatus.style.color = ''; - }, 3000); - } - }, 5 * 60 * 1000); - } catch (err) { - console.error('Failed to access camera/microphone:', err); - alert('Unable to access camera or microphone. Check permissions.'); - } - }); - // File input change handlers for conversation - [conversationImageInput, conversationVideoInput, conversationFileInput, conversationCameraInput].forEach(input => { + [conversationImageInput, conversationVideoInput, conversationFileInput].forEach(input => { input.addEventListener('change', (e) => { pendingConversationAttachments.push(...Array.from(e.target.files || [])); renderConversationAttachmentsList(); @@ -1951,7 +1797,6 @@ conversationImageInput.value = ''; conversationVideoInput.value = ''; conversationFileInput.value = ''; - conversationCameraInput.value = ''; renderConversationAttachmentsList(); }); @@ -2143,7 +1988,6 @@ document.getElementById('imageInput').value = ''; document.getElementById('videoInput').value = ''; document.getElementById('fileInput').value = ''; - document.getElementById('cameraInput').value = ''; renderNoteAttachmentsList(); document.getElementById('noteText').value = ''; document.getElementById('noteTitle').value = '';