Spaces:
Running
Running
Update static/application.js
Browse files- static/application.js +8 -4
static/application.js
CHANGED
@@ -171,24 +171,27 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
171 |
let selectedFile = null;
|
172 |
let filePreviewBubble = null;
|
173 |
|
174 |
-
//
|
175 |
const fileInput = document.createElement("input");
|
176 |
fileInput.type = "file";
|
177 |
fileInput.style.display = "none";
|
178 |
document.body.appendChild(fileInput);
|
179 |
|
|
|
180 |
fileBtn.addEventListener("click", () => {
|
181 |
-
fileInput.value = "";
|
182 |
fileInput.accept = ".pdf,.docx,.pptx,.xlsx";
|
183 |
fileInput.click();
|
184 |
});
|
185 |
|
|
|
186 |
imageBtn.addEventListener("click", () => {
|
187 |
fileInput.value = "";
|
188 |
fileInput.accept = "image/*";
|
189 |
fileInput.click();
|
190 |
});
|
191 |
|
|
|
192 |
fileInput.addEventListener("change", () => {
|
193 |
const file = fileInput.files[0];
|
194 |
if (file) {
|
@@ -203,6 +206,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
203 |
}
|
204 |
});
|
205 |
|
|
|
206 |
convo.addEventListener("dragover", (e) => {
|
207 |
e.preventDefault();
|
208 |
convo.classList.add("drag-over");
|
@@ -267,7 +271,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
267 |
let isMuted = false;
|
268 |
icon.addEventListener("click", () => {
|
269 |
if (isMuted) {
|
270 |
-
currentAudio = new Audio(audioSrc);
|
271 |
currentAudio.play();
|
272 |
isMuted = false;
|
273 |
icon.classList.replace("fa-volume-xmark", "fa-volume-high");
|
@@ -343,7 +347,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
343 |
let isMuted = false;
|
344 |
icon.addEventListener("click", () => {
|
345 |
if (isMuted) {
|
346 |
-
currentAudio = new Audio(audioSrc); // restart
|
347 |
currentAudio.play();
|
348 |
isMuted = false;
|
349 |
icon.classList.replace("fa-volume-xmark", "fa-volume-high");
|
|
|
171 |
let selectedFile = null;
|
172 |
let filePreviewBubble = null;
|
173 |
|
174 |
+
// Create a hidden input
|
175 |
const fileInput = document.createElement("input");
|
176 |
fileInput.type = "file";
|
177 |
fileInput.style.display = "none";
|
178 |
document.body.appendChild(fileInput);
|
179 |
|
180 |
+
// Choose document
|
181 |
fileBtn.addEventListener("click", () => {
|
182 |
+
fileInput.value = ""; // ✅ allow selecting same file again
|
183 |
fileInput.accept = ".pdf,.docx,.pptx,.xlsx";
|
184 |
fileInput.click();
|
185 |
});
|
186 |
|
187 |
+
// Choose image
|
188 |
imageBtn.addEventListener("click", () => {
|
189 |
fileInput.value = "";
|
190 |
fileInput.accept = "image/*";
|
191 |
fileInput.click();
|
192 |
});
|
193 |
|
194 |
+
// Handle file selection
|
195 |
fileInput.addEventListener("change", () => {
|
196 |
const file = fileInput.files[0];
|
197 |
if (file) {
|
|
|
206 |
}
|
207 |
});
|
208 |
|
209 |
+
// Drag & drop support
|
210 |
convo.addEventListener("dragover", (e) => {
|
211 |
e.preventDefault();
|
212 |
convo.classList.add("drag-over");
|
|
|
271 |
let isMuted = false;
|
272 |
icon.addEventListener("click", () => {
|
273 |
if (isMuted) {
|
274 |
+
currentAudio = new Audio(audioSrc); // restart
|
275 |
currentAudio.play();
|
276 |
isMuted = false;
|
277 |
icon.classList.replace("fa-volume-xmark", "fa-volume-high");
|
|
|
347 |
let isMuted = false;
|
348 |
icon.addEventListener("click", () => {
|
349 |
if (isMuted) {
|
350 |
+
currentAudio = new Audio(audioSrc); // restart
|
351 |
currentAudio.play();
|
352 |
isMuted = false;
|
353 |
icon.classList.replace("fa-volume-xmark", "fa-volume-high");
|