Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ let activeMarker = null;
+ let isRecording = false;
+
+ // Navigation
+ const navLinks = document.querySelectorAll('.nav-links a');
+ const pages = document.querySelectorAll('.page');
+
+ navLinks.forEach(link => {
+ link.addEventListener('click', (e) => {
+ e.preventDefault();
+ const targetPage = link.dataset.page;
+
+ navLinks.forEach(l => l.classList.remove('active'));
+ link.classList.add('active');
+
+ pages.forEach(page => {
+ page.classList.add('hidden');
+ if (page.id === `${targetPage}Page`) {
+ page.classList.remove('hidden');
+ }
+ });
+ });
+ });
+
+ // Chat functionality
+ const userInput = document.getElementById('userInput');
+ const sendButton = document.getElementById('sendButton');
+ const messageArea = document.getElementById('messageArea');
+
+ function sendMessage() {
+ const text = userInput.value.trim();
+ if (text) {
+ const markerData = activeMarker ? activeMarker : 'no';
+ // Here you would send to backend: { text, markerData }
+
+ const messageElement = document.createElement('div');
+ messageElement.textContent = `Sent: ${text} (Marker: ${markerData})`;
+ messageArea.appendChild(messageElement);
+
+ userInput.value = '';
+ messageArea.scrollTop = messageArea.scrollHeight;
+ }
+ }
+
+ sendButton.addEventListener('click', sendMessage);
+ userInput.addEventListener('keypress', (e) => {
+ if (e.key === 'Enter') {
+ sendMessage();
+ }
+ });
+
+ // Recording control
+ const recordToggle = document.getElementById('recordToggle');
+ const statusDot = document.querySelector('.dot');
+ const statusText = document.getElementById('statusText');
+
+ recordToggle.addEventListener('click', () => {
+ isRecording = !isRecording;
+ recordToggle.textContent = isRecording ? 'Stop Recording' : 'Start Recording';
+ recordToggle.style.background = isRecording ? '#e74c3c' : '#3498db';
+ statusDot.style.background = isRecording ? '#2ecc71' : '#e74c3c';
+ statusText.textContent = isRecording ? 'Online - Recording' : 'Online - Idle';
+ });
+
+ // Simulated device metrics update
+ function updateMetrics() {
+ const batteryLevel = document.getElementById('batteryLevel');
+ const signalStrength = document.getElementById('signalStrength');
+
+ setInterval(() => {
+ const battery = Math.floor(Math.random() * 30) + 70; // 70-100
+ batteryLevel.textContent = `${battery}%`;
+
+ const signals = ['Weak', 'Moderate', 'Strong'];
+ const randomSignal = signals[Math.floor(Math.random() * signals.length)];
+ signalStrength.textContent = randomSignal;
+ }, 5000);
+ }
+
+ updateMetrics();
+ });