# mxchat-basic/1.1.8/js/mxchat-admin.js

MxChat – AI Chatbot &amp; Content Generation for WordPress, version 1.1.8. 82 lines.

- Page: https://pluginprobe.com/plugins/mxchat-basic/1.1.8/code/js/mxchat-admin.js
- Raw: https://pluginprobe.com/plugins/mxchat-basic/1.1.8/raw/js/mxchat-admin.js
- Modified: 2024-10-23T00:39:52+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/1.1.8/code/js/mxchat-admin.js#L10-L20`.

```javascript
jQuery(document).ready(function($) {
    $('#mxchat-activation-form').on('submit', function(event) {
        event.preventDefault();

        var formData = {
            action: 'mxchat_activate_license',
            email: $('#mxchat_pro_email').val(),
            key: $('#mxchat_activation_key').val(),
            security: mxchatAdmin.nonce
        };

        $.post(mxchatAdmin.ajax_url, formData, function(response) {
            if (response.success) {
                $('#mxchat-license-status').text('Active');
            } else {
                $('#mxchat-license-status').text('Inactive');
                alert(response.data);
            }
        });
    });

    $('.mxchat-nav-tab').on('click', function(e) {
        e.preventDefault();
        $('.mxchat-nav-tab').removeClass('mxchat-nav-tab-active');
        $(this).addClass('mxchat-nav-tab-active');
        $('.mxchat-tab-content').removeClass('active').hide();
        var activeTab = $(this).attr('href');
        $(activeTab).addClass('active').show();
    });

    // Activate the first tab by default
    $('.mxchat-nav-tab-active').trigger('click');

    // Toggle visibility of API key
    $('#toggleApiKeyVisibility').on('click', function() {
        var apiKeyInput = $('#api_key');
        if (apiKeyInput.attr('type') === 'password') {
            apiKeyInput.attr('type', 'text');
            $(this).text('Hide');
        } else {
            apiKeyInput.attr('type', 'password');
            $(this).text('Show');
        }
    });
    
    // Toggle visibility of WooCommerce Consumer Secret
    $('#toggleWooCommerceSecretVisibility').on('click', function() {
        var secretInput = $('#woocommerce_consumer_secret');
        if (secretInput.attr('type') === 'password') {
            secretInput.attr('type', 'text');
            $(this).text('Hide');
        } else {
            secretInput.attr('type', 'password');
            $(this).text('Show');
        }
    });
    
    // Toggle visibility of Loops API Key
    $('#toggleLoopsApiKeyVisibility').on('click', function() {
        var loopsApiKeyInput = $('#loops_api_key');
        if (loopsApiKeyInput.attr('type') === 'password') {
            loopsApiKeyInput.attr('type', 'text');
            $(this).text('Hide');
        } else {
            loopsApiKeyInput.attr('type', 'password');
            $(this).text('Show');
        }
    });
    
    // Toggle visibility of X.AI API Key
    $('#toggleXaiApiKeyVisibility').on('click', function() {
        var xaiApiKeyInput = $('#xai_api_key');
        if (xaiApiKeyInput.attr('type') === 'password') {
            xaiApiKeyInput.attr('type', 'text');
            $(this).text('Hide');
        } else {
            xaiApiKeyInput.attr('type', 'password');
            $(this).text('Show');
        }
    });
});

```
