| 1 |
document.addEventListener('DOMContentLoaded', function() { |
| 2 |
var urlParams = new URLSearchParams(window.location.search); |
| 3 |
if (urlParams.has('embedding_failed')) { |
| 4 |
alert('Failed to generate embedding for the content. Please try submitting again.'); |
| 5 |
} |
| 6 |
|
| 7 |
var sitemapForm = document.getElementById('mxchat-sitemap-form'); |
| 8 |
|
| 9 |
// Only proceed if the sitemapForm element exists |
| 10 |
if (sitemapForm) { |
| 11 |
var loadingSpinner = document.getElementById('mxchat-sitemap-loading'); |
| 12 |
var loadingText = document.getElementById('mxchat-loading-text'); |
| 13 |
var sitemapUrlField = document.getElementById('sitemap_url'); |
| 14 |
var submitButton = sitemapForm.querySelector('input[type="submit"]'); |
| 15 |
|
| 16 |
sitemapForm.addEventListener('submit', function() { |
| 17 |
// Hide the form fields |
| 18 |
sitemapUrlField.style.display = 'none'; |
| 19 |
submitButton.style.display = 'none'; |
| 20 |
|
| 21 |
// Show the loading spinner and text |
| 22 |
loadingSpinner.style.display = 'flex'; |
| 23 |
loadingText.style.display = 'block'; |
| 24 |
}); |
| 25 |
} |
| 26 |
}); |
| 27 |
|