Spaces:
Runtime error
Runtime error
Update templates/index.html
Browse files- templates/index.html +61 -44
templates/index.html
CHANGED
|
@@ -146,6 +146,7 @@
|
|
| 146 |
}
|
| 147 |
.disabled {
|
| 148 |
cursor: not-allowed !important; /* Set cursor to not-allowed */
|
|
|
|
| 149 |
}
|
| 150 |
|
| 151 |
/* Responsive design */
|
|
@@ -204,56 +205,72 @@
|
|
| 204 |
<script>
|
| 205 |
// Loader functionality
|
| 206 |
document.getElementById('fileUploadForm').onsubmit = function() {
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
};
|
| 223 |
-
|
| 224 |
// Flash message auto-hide
|
| 225 |
setTimeout(function () {
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
}, 3000); // Adjust timing based on your upload duration
|
| 246 |
-
|
| 247 |
// Function to open links in the same tab
|
| 248 |
function openLink(url, element) {
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
}
|
| 258 |
</script>
|
| 259 |
</body>
|
|
|
|
| 146 |
}
|
| 147 |
.disabled {
|
| 148 |
cursor: not-allowed !important; /* Set cursor to not-allowed */
|
| 149 |
+
opacity: 0.6;
|
| 150 |
}
|
| 151 |
|
| 152 |
/* Responsive design */
|
|
|
|
| 205 |
<script>
|
| 206 |
// Loader functionality
|
| 207 |
document.getElementById('fileUploadForm').onsubmit = function() {
|
| 208 |
+
document.getElementById('loader').style.display = 'block';
|
| 209 |
+
|
| 210 |
+
// Disable the tab buttons and apply disabled class
|
| 211 |
+
const buttons = document.querySelectorAll('.tab button');
|
| 212 |
+
buttons.forEach(button => {
|
| 213 |
+
button.setAttribute('disabled', 'true');
|
| 214 |
+
button.classList.add('disabled'); // Add disabled class
|
| 215 |
+
});
|
| 216 |
+
|
| 217 |
+
// Disable the "Choose file" input and "Upload your Images" button
|
| 218 |
+
const fileInput = document.querySelector('input[type="file"]');
|
| 219 |
+
const uploadButton = document.querySelector('input[type="submit"]');
|
| 220 |
+
fileInput.setAttribute('disabled', 'true');
|
| 221 |
+
uploadButton.setAttribute('disabled', 'true');
|
| 222 |
+
fileInput.classList.add('disabled');
|
| 223 |
+
uploadButton.classList.add('disabled');
|
| 224 |
+
|
| 225 |
+
// Show processing message
|
| 226 |
+
const processingMessage = document.createElement('p');
|
| 227 |
+
processingMessage.id = 'processing-message';
|
| 228 |
+
processingMessage.textContent = 'Processing, please wait...';
|
| 229 |
+
processingMessage.style.color = '#e68a10'; // Style as needed
|
| 230 |
+
document.querySelector('.file-upload-section').appendChild(processingMessage);
|
| 231 |
};
|
| 232 |
+
|
| 233 |
// Flash message auto-hide
|
| 234 |
setTimeout(function () {
|
| 235 |
+
let flashMessage = document.getElementById("flash-message");
|
| 236 |
+
if (flashMessage) {
|
| 237 |
+
flashMessage.style.transition = "opacity 1s ease";
|
| 238 |
+
flashMessage.style.opacity = 0;
|
| 239 |
+
setTimeout(() => flashMessage.remove(), 1000);
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
// After processing is complete (You can adjust this based on your logic)
|
| 243 |
+
const processingMessage = document.getElementById('processing-message');
|
| 244 |
+
if (processingMessage) {
|
| 245 |
+
processingMessage.remove(); // Remove the processing message
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
// Re-enable tab buttons and remove disabled class
|
| 249 |
+
const buttons = document.querySelectorAll('.tab button');
|
| 250 |
+
buttons.forEach(button => {
|
| 251 |
+
button.removeAttribute('disabled');
|
| 252 |
+
button.classList.remove('disabled'); // Remove disabled class
|
| 253 |
+
});
|
| 254 |
+
|
| 255 |
+
// Re-enable the file input and submit button
|
| 256 |
+
const fileInput = document.querySelector('input[type="file"]');
|
| 257 |
+
const uploadButton = document.querySelector('input[type="submit"]');
|
| 258 |
+
fileInput.removeAttribute('disabled');
|
| 259 |
+
uploadButton.removeAttribute('disabled');
|
| 260 |
+
fileInput.classList.remove('disabled');
|
| 261 |
+
uploadButton.classList.remove('disabled');
|
| 262 |
}, 3000); // Adjust timing based on your upload duration
|
| 263 |
+
|
| 264 |
// Function to open links in the same tab
|
| 265 |
function openLink(url, element) {
|
| 266 |
+
window.location.href = url; // Redirects to the specified URL in the same tab
|
| 267 |
+
|
| 268 |
+
// Remove "active" class from all buttons
|
| 269 |
+
const buttons = document.querySelectorAll('.tab button');
|
| 270 |
+
buttons.forEach(button => button.classList.remove('active'));
|
| 271 |
+
|
| 272 |
+
// Add "active" class to the clicked button
|
| 273 |
+
element.classList.add('active');
|
| 274 |
}
|
| 275 |
</script>
|
| 276 |
</body>
|