| @@ -3,11 +3,11 @@ | ||
| 3 | 3 | if (urlParams.has('embedding_failed')) { |
| 4 | 4 | alert('Failed to generate embedding for the content. Please try submitting again.'); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | - // Sitemap Form Loader | |
| 8 | 7 | var sitemapForm = document.getElementById('mxchat-sitemap-form'); |
| 9 | 8 | |
| 9 | + // Only proceed if the sitemapForm element exists | |
| 10 | 10 | if (sitemapForm) { |
| 11 | 11 | var loadingSpinner = document.getElementById('mxchat-sitemap-loading'); |
| 12 | 12 | var loadingText = document.getElementById('mxchat-loading-text'); |
| 13 | 13 | var sitemapUrlField = document.getElementById('sitemap_url'); |
| @@ -13,34 +13,14 @@ | ||
| 13 | 13 | var sitemapUrlField = document.getElementById('sitemap_url'); |
| 14 | 14 | var submitButton = sitemapForm.querySelector('input[type="submit"]'); |
| 15 | 15 | |
| 16 | 16 | sitemapForm.addEventListener('submit', function() { |
| 17 | + // Hide the form fields | |
| 17 | 18 | sitemapUrlField.style.display = 'none'; |
| 18 | 19 | submitButton.style.display = 'none'; |
| 19 | 20 | |
| 21 | + // Show the loading spinner and text | |
| 20 | 22 | loadingSpinner.style.display = 'flex'; |
| 21 | 23 | 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 | 24 | }); |
| 45 | 25 | } |
| 46 | 26 | }); |