Update static/js/script.js
Browse files- static/js/script.js +9 -3
static/js/script.js
CHANGED
|
@@ -26,9 +26,9 @@ function captureImage() {
|
|
| 26 |
.then(response => response.json())
|
| 27 |
.then(data => {
|
| 28 |
console.log(data.message);
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
})
|
| 33 |
.catch(console.error);
|
| 34 |
}
|
|
@@ -59,9 +59,15 @@ function performOCR() {
|
|
| 59 |
function showLoading() {
|
| 60 |
const loadingElement = document.getElementById('loading');
|
| 61 |
loadingElement.style.display = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
function hideLoading() {
|
|
|
|
| 65 |
const loadingElement = document.getElementById('loading');
|
| 66 |
loadingElement.style.display = 'none';
|
| 67 |
}
|
|
|
|
| 26 |
.then(response => response.json())
|
| 27 |
.then(data => {
|
| 28 |
console.log(data.message);
|
| 29 |
+
alert("Image captured successfully!");
|
| 30 |
+
document.getElementById('captured-image').src = imageData;
|
| 31 |
+
document.getElementById('captured-image').style.display = 'block';
|
| 32 |
})
|
| 33 |
.catch(console.error);
|
| 34 |
}
|
|
|
|
| 59 |
function showLoading() {
|
| 60 |
const loadingElement = document.getElementById('loading');
|
| 61 |
loadingElement.style.display = 'block';
|
| 62 |
+
let dots = 0;
|
| 63 |
+
loadingInterval = setInterval(() => {
|
| 64 |
+
dots = (dots + 1) % 4;
|
| 65 |
+
loadingElement.innerText = 'Loading' + '.'.repeat(dots);
|
| 66 |
+
}, 500);
|
| 67 |
}
|
| 68 |
|
| 69 |
function hideLoading() {
|
| 70 |
+
clearInterval(loadingInterval);
|
| 71 |
const loadingElement = document.getElementById('loading');
|
| 72 |
loadingElement.style.display = 'none';
|
| 73 |
}
|