Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ const themeToggle = document.getElementById('themeToggle');
+ const transcriptInput = document.getElementById('transcriptInput');
+ const annotationText = document.getElementById('annotationText');
+ const annotationType = document.getElementById('annotationType');
+ const addAnnotationBtn = document.getElementById('addAnnotation');
+ const annotationList = document.getElementById('annotationList');
+
+ // Theme toggling
+ themeToggle.addEventListener('click', () => {
+ document.documentElement.setAttribute(
+ 'data-theme',
+ document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark'
+ );
+ });
+
+ // Add annotation
+ addAnnotationBtn.addEventListener('click', () => {
+ const text = annotationText.value.trim();
+ if (!text) return;
+
+ const annotation = document.createElement('div');
+ annotation.className = `annotation ${annotationType.value}`;
+ annotation.innerHTML = `
+ ${new Date().toLocaleTimeString()}
+ `;
+
+ annotationList.appendChild(annotation);
+ annotationText.value = '';
+
+ // Scroll to bottom of annotation list
+ annotationList.scrollTop = annotationList.scrollHeight;
+ });
+
+ // Handle enter key in annotation input
+ annotationText.addEventListener('keypress', (e) => {
+ if (e.key === 'Enter') {
+ addAnnotationBtn.click();
+ }
+ });
+
+ // Auto-save transcript to localStorage
+ transcriptInput.addEventListener('input', () => {
+ localStorage.setItem('savedTranscript', transcriptInput.value);
+ });
+
+ // Load saved transcript
+ const savedTranscript = localStorage.getItem('savedTranscript');
+ if (savedTranscript) {
+ transcriptInput.value = savedTranscript;
+ }
+ });