PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / trunk
MxChat – AI Chatbot & Content Generation for WordPress vtrunk
3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 2.0.3 2.0.4 2.0.5 2.0.6 All 152 releases
← All changes | js/content-selector.js +44 -5 3.2.2trunk View file →
@@ -8,11 +8,13 @@
8 8 const $pagination = $('.mxchat-kb-pagination');
9 9 const $processButton = $('#mxchat-kb-process-selected');
10 10 const $selectAll = $('#mxchat-kb-select-all');
11 11 const $selectionCount = $('.mxchat-kb-selection-count');
12 -
12 + // ACF→PDF extraction is an install-level setting (Knowledge → ACF Fields);
13 + // the server reads the stored option — nothing to collect in this modal.
14 +
13 15 // Filter elements
14 - const $searchInput = $('#mxchat-kb-content-search');1
16 + const $searchInput = $('#mxchat-kb-content-search');
15 17 const $typeFilter = $('#mxchat-kb-content-type-filter');
16 18 const $statusFilter = $('#mxchat-kb-content-status-filter');
17 19 const $processedFilter = $('#mxchat-kb-processed-filter');
18 20
@@ -48,9 +50,9 @@
48 50 $('.mxchat-import-box').removeClass('active');
49 51 $box.addClass('active');
50 52
51 53 // Hide all input areas
52 - $('#mxchat-url-input-area, #mxchat-content-input-area, #mxchat-pdf-upload-area').hide();
54 + $('#mxchat-url-input-area, #mxchat-content-input-area, #mxchat-pdf-upload-area, #mxchat-document-upload-area, #mxchat-youtube-input-area').hide();
53 55
54 56 // Hide sitemap-specific sections (but NOT for sitemap option - let detection logic handle it)
55 57 if (option !== 'sitemap') {
56 58 $('#mxchat-detected-sitemaps, #mxchat-no-sitemaps, #mxchat-sitemaps-loading').hide();
@@ -105,11 +107,43 @@
105 107
106 108 // Add or update bot_id hidden field for PDF upload form
107 109 updateBotIdInForm('#mxchat-pdf-upload-form');
108 110 break;
111 +
112 + case 'document-upload':
113 + // Show document (.docx/.txt/.md) upload area
114 + $('#mxchat-document-upload-area').show();
115 +
116 + // Add or update bot_id hidden field for the document upload form
117 + updateBotIdInForm('#mxchat-document-upload-form');
118 + break;
119 +
120 + case 'youtube':
121 + // Show YouTube import area
122 + $('#mxchat-youtube-input-area').show();
123 +
124 + // Add or update bot_id hidden field for YouTube form
125 + updateBotIdInForm('#mxchat-youtube-form');
126 + break;
109 127 }
110 128 });
111 129
130 +// YouTube import: toggle the manual-description box with the mode radios, and
131 +// only require the textarea when "Write my own" is selected.
132 +$(document).on('change', 'input[name="youtube_description_mode"]', function() {
133 + const manual = $('input[name="youtube_description_mode"]:checked').val() === 'manual';
134 + $('#mxchat-youtube-description-field').toggle(manual);
135 + $('#mxchat-youtube-description').prop('required', manual);
136 +});
137 +
138 +// If the server bounced back with prefill state (auto-import found no
139 +// transcript), reopen the YouTube form in manual mode ready to augment.
140 +if ($('#mxchat-youtube-form').data('yt-prefill')) {
141 + $('.mxchat-import-box[data-option="youtube"]').trigger('click');
142 + $('input[name="youtube_description_mode"]').trigger('change');
143 + $('#mxchat-youtube-description').trigger('focus');
144 +}
145 +
112 146 // Helper function to add/update bot_id hidden field in forms
113 147 function updateBotIdInForm(formSelector) {
114 148 const $form = $(formSelector);
115 149 if ($form.length === 0) return;
@@ -534,10 +568,15 @@
534 568 title: response.data.title || ('ID: ' + postId)
535 569 });
536 570 }
537 571
538 - $progressModal.find('.mxchat-kb-current-item')
539 - .text('Successfully ' + (isUpdate ? 'updated' : 'processed') + ': ' + response.data.title);
572 + let successText = 'Successfully ' + (isUpdate ? 'updated' : 'processed') + ': ' + response.data.title;
573 + const pdfCount = parseInt(response.data.pdf_extracted_count, 10) || 0;
574 + if (pdfCount > 0) {
575 + const suffixTpl = (mxchatSelector.i18n && mxchatSelector.i18n.pdfExtractedSuffix) || ' (%d PDF(s) extracted)';
576 + successText += suffixTpl.replace('%d', pdfCount);
577 + }
578 + $progressModal.find('.mxchat-kb-current-item').text(successText);
540 579 } else {
541 580 failed++;
542 581 results.failed.push({
543 582 id: postId,