Update app.py
Browse files
app.py
CHANGED
|
@@ -358,23 +358,22 @@ html_footer = """
|
|
| 358 |
if (submitBtn) {
|
| 359 |
submitBtn.addEventListener('click', function() {
|
| 360 |
showLoading();
|
| 361 |
-
|
| 362 |
-
|
|
|
|
|
|
|
| 363 |
if (output && output.textContent.trim().length > 0) {
|
| 364 |
hideLoading();
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
if (output && output.textContent.trim().length > 0) {
|
| 368 |
-
hideLoading();
|
| 369 |
-
clearInterval(checkInterval);
|
| 370 |
-
}
|
| 371 |
-
}, 1000);
|
| 372 |
-
setTimeout(function() {
|
| 373 |
-
hideLoading();
|
| 374 |
-
clearInterval(checkInterval);
|
| 375 |
-
}, 30000);
|
| 376 |
}
|
| 377 |
-
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
});
|
| 379 |
}
|
| 380 |
});
|
|
|
|
| 358 |
if (submitBtn) {
|
| 359 |
submitBtn.addEventListener('click', function() {
|
| 360 |
showLoading();
|
| 361 |
+
const output = document.querySelector('.recipe-output');
|
| 362 |
+
|
| 363 |
+
// Check every second for output content
|
| 364 |
+
const checkInterval = setInterval(function() {
|
| 365 |
if (output && output.textContent.trim().length > 0) {
|
| 366 |
hideLoading();
|
| 367 |
+
clearInterval(checkInterval);
|
| 368 |
+
clearTimeout(forceHideTimeout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
}
|
| 370 |
+
}, 60000);
|
| 371 |
+
|
| 372 |
+
// Force hide after 120 seconds
|
| 373 |
+
const forceHideTimeout = setTimeout(function() {
|
| 374 |
+
hideLoading();
|
| 375 |
+
clearInterval(checkInterval);
|
| 376 |
+
}, 120000); // 120000 milliseconds = 120 seconds
|
| 377 |
});
|
| 378 |
}
|
| 379 |
});
|