# mxchat-basic/2.0.3/js/mxchat_transcripts.js

MxChat – AI Chatbot &amp; Content Generation for WordPress, version 2.0.3. 70 lines.

- Page: https://pluginprobe.com/plugins/mxchat-basic/2.0.3/code/js/mxchat_transcripts.js
- Raw: https://pluginprobe.com/plugins/mxchat-basic/2.0.3/raw/js/mxchat_transcripts.js
- Modified: 2025-02-13T02:52:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/mxchat-basic/2.0.3/code/js/mxchat_transcripts.js#L10-L20`.

```javascript
    jQuery(document).ready(function($) {
        const selectButton = $('#mxchat-select-all-transcripts');
            let isSelected = false;
        
            selectButton.click(function() {
                isSelected = !isSelected;
                $(this).toggleClass('selected');
                
                // Update button text
                const buttonText = $(this).find('.button-text');
                buttonText.text(isSelected ? 'Deselect All' : 'Select All');
                
                // Update checkboxes
                $('#mxchat-transcripts').find('input[type=checkbox]').prop('checked', isSelected);
            });

        // Search functionality
        $('#mxchat-search-transcripts').on('input', function() {
            var searchTerm = $(this).val().toLowerCase();
            $('.mxchat-session').each(function() {
                var sessionText = $(this).text().toLowerCase();
                $(this).toggle(sessionText.includes(searchTerm));
            });
        });

        // Load transcripts
        $.ajax({
            url: ajaxurl,
            type: 'POST',
            data: {
                action: 'mxchat_fetch_chat_history'
            },
            success: function(response) {
                $('#mxchat-transcripts').html(response);
            }
        });

        // Your existing delete form submission code remains the same
        $('#mxchat-delete-form').submit(function(e) {
        e.preventDefault();
        var checkedSessionIds = $('input[name="delete_session_ids[]"]:checked').map(function() {
            return $(this).val();
        }).get();
        $.ajax({
            url: ajaxurl,
            type: 'POST',
            data: {
                action: 'mxchat_delete_chat_history',
                delete_session_ids: checkedSessionIds,
                security: $('#mxchat_delete_chat_nonce').val()
            },
            success: function(response) {
                var jsonResponse = JSON.parse(response);
                if (jsonResponse.success) {
                    alert("Success: " + jsonResponse.success);
                } else if (jsonResponse.error) {
                    alert("Error: " + jsonResponse.error);
                } else {
                    //console.log("Unexpected response format.");
                }
                location.reload();
            },
            error: function(xhr, status, error) {
                //console.error("AJAX Error: " + status + " - " + error);
                //console.log(xhr.responseText);
            }
        });
    });
});

```
