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 +37 -11 3.2.11trunk View file →
@@ -8,17 +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 - const $acfPdfExtractCheckbox = $('#mxchat-kb-acf-pdf-extract');
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.
13 14
14 - // Restore last-used ACF→PDF extract preference from the server-localized default.
15 - if (typeof mxchatSelector !== 'undefined' && mxchatSelector.acfPdfExtractDefault) {
16 - $acfPdfExtractCheckbox.prop('checked', true);
17 - }
18 -
19 15 // Filter elements
20 - const $searchInput = $('#mxchat-kb-content-search');1
16 + const $searchInput = $('#mxchat-kb-content-search');
21 17 const $typeFilter = $('#mxchat-kb-content-type-filter');
22 18 const $statusFilter = $('#mxchat-kb-content-status-filter');
23 19 const $processedFilter = $('#mxchat-kb-processed-filter');
24 20
@@ -54,9 +50,9 @@
54 50 $('.mxchat-import-box').removeClass('active');
55 51 $box.addClass('active');
56 52
57 53 // Hide all input areas
58 - $('#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();
59 55
60 56 // Hide sitemap-specific sections (but NOT for sitemap option - let detection logic handle it)
61 57 if (option !== 'sitemap') {
62 58 $('#mxchat-detected-sitemaps, #mxchat-no-sitemaps, #mxchat-sitemaps-loading').hide();
@@ -111,11 +107,43 @@
111 107
112 108 // Add or update bot_id hidden field for PDF upload form
113 109 updateBotIdInForm('#mxchat-pdf-upload-form');
114 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;
115 127 }
116 128 });
117 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 +
118 146 // Helper function to add/update bot_id hidden field in forms
119 147 function updateBotIdInForm(formSelector) {
120 148 const $form = $(formSelector);
121 149 if ($form.length === 0) return;
@@ -506,15 +534,13 @@
506 534 .text((isUpdate ? 'Updating' : 'Processing') + ' ' + (index + 1) + ' of ' + totalToProcess + '...');
507 535 $progressModal.find('.mxchat-kb-progress-fill').css('width', percent + '%');
508 536
509 537 // UPDATED: Prepare AJAX data with bot_id
510 - const extractAcfPdfs = $acfPdfExtractCheckbox.prop('checked') ? 1 : 0;
511 538 const ajaxData = {
512 539 action: 'mxchat_process_selected_content',
513 540 nonce: mxchatSelector.nonce,
514 541 post_ids: [postId],
515 - is_update: isUpdate,
516 - extract_acf_pdfs: extractAcfPdfs
542 + is_update: isUpdate
517 543 };
518 544
519 545 // Add bot_id if multi-bot is active and not default
520 546 if (currentBotId && currentBotId !== 'default') {