ikraamkb commited on
Commit
6ce7adf
·
verified ·
1 Parent(s): 6fb7ab4

Update static/application.js

Browse files
Files changed (1) hide show
  1. static/application.js +3 -5
static/application.js CHANGED
@@ -68,7 +68,6 @@ document.addEventListener("DOMContentLoaded", () => {
68
 
69
  icon.addEventListener("click", () => {
70
  if (audio.muted) {
71
- // When unmuting, restart from beginning
72
  audio.currentTime = 0;
73
  audio.muted = false;
74
  icon.classList.remove("fa-volume-xmark");
@@ -76,7 +75,6 @@ document.addEventListener("DOMContentLoaded", () => {
76
  icon.title = "Click to mute";
77
  audio.play();
78
  } else {
79
- // When muting, just mute
80
  audio.muted = true;
81
  icon.classList.remove("fa-volume-high");
82
  icon.classList.add("fa-volume-xmark");
@@ -147,7 +145,6 @@ document.addEventListener("DOMContentLoaded", () => {
147
 
148
  icon.addEventListener("click", () => {
149
  if (audio.muted) {
150
- // Restart audio when unmuting
151
  audio.currentTime = 0;
152
  audio.muted = false;
153
  icon.classList.remove("fa-volume-xmark");
@@ -171,7 +168,7 @@ document.addEventListener("DOMContentLoaded", () => {
171
  message.innerText = "⚠️ Aidan had trouble responding.";
172
  }
173
 
174
- // Clear inputs after sending
175
  input.value = "";
176
  selectedFile = null;
177
  }
@@ -180,8 +177,9 @@ document.addEventListener("DOMContentLoaded", () => {
180
  sendBtn.addEventListener("click", sendMessage);
181
 
182
  // Enter key event for input field
183
- input.addEventListener("keyup", (event) => {
184
  if (event.key === "Enter") {
 
185
  sendMessage();
186
  }
187
  });
 
68
 
69
  icon.addEventListener("click", () => {
70
  if (audio.muted) {
 
71
  audio.currentTime = 0;
72
  audio.muted = false;
73
  icon.classList.remove("fa-volume-xmark");
 
75
  icon.title = "Click to mute";
76
  audio.play();
77
  } else {
 
78
  audio.muted = true;
79
  icon.classList.remove("fa-volume-high");
80
  icon.classList.add("fa-volume-xmark");
 
145
 
146
  icon.addEventListener("click", () => {
147
  if (audio.muted) {
 
148
  audio.currentTime = 0;
149
  audio.muted = false;
150
  icon.classList.remove("fa-volume-xmark");
 
168
  message.innerText = "⚠️ Aidan had trouble responding.";
169
  }
170
 
171
+ // Clear inputs after processing is complete
172
  input.value = "";
173
  selectedFile = null;
174
  }
 
177
  sendBtn.addEventListener("click", sendMessage);
178
 
179
  // Enter key event for input field
180
+ input.addEventListener("keydown", (event) => {
181
  if (event.key === "Enter") {
182
+ event.preventDefault(); // Prevent form submission
183
  sendMessage();
184
  }
185
  });