| 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 |
// Sitemap Form Loader |
| 8 |
var sitemapForm = document.getElementById('mxchat-sitemap-form'); |
| 9 |
|
| 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 |
sitemapUrlField.style.display = 'none'; |
| 18 |
submitButton.style.display = 'none'; |
| 19 |
|
| 20 |
loadingSpinner.style.display = 'flex'; |
| 21 |
loadingText.style.display = 'block'; |
| 22 |
}); |
| 23 |
} |
| 24 |
|
| 25 |
// Submit Content Form Loader |
| 26 |
var contentForm = document.getElementById('mxchat-content-form'); |
| 27 |
|
| 28 |
if (contentForm) { |
| 29 |
var contentLoadingSpinner = document.getElementById('mxchat-content-loading'); |
| 30 |
var contentLoadingText = document.getElementById('mxchat-content-loading-text'); |
| 31 |
var articleContentField = document.getElementById('article_content'); |
| 32 |
var articleUrlField = document.getElementById('article_url'); |
| 33 |
var contentSubmitButton = contentForm.querySelector('input[type="submit"]'); |
| 34 |
|
| 35 |
contentForm.addEventListener('submit', function() { |
| 36 |
// Hide form fields |
| 37 |
articleContentField.style.display = 'none'; |
| 38 |
articleUrlField.style.display = 'none'; |
| 39 |
contentSubmitButton.style.display = 'none'; |
| 40 |
|
| 41 |
// Show loading spinner and text |
| 42 |
contentLoadingSpinner.style.display = 'flex'; |
| 43 |
contentLoadingText.style.display = 'block'; |
| 44 |
}); |
| 45 |
} |
| 46 |
}); |
| 47 |
|