| 1 |
jQuery(document).ready(function($) { |
| 2 |
$('#mxchat-activation-form').on('submit', function(event) { |
| 3 |
event.preventDefault(); |
| 4 |
|
| 5 |
var formData = { |
| 6 |
action: 'mxchat_activate_license', |
| 7 |
email: $('#mxchat_pro_email').val(), |
| 8 |
key: $('#mxchat_activation_key').val(), |
| 9 |
security: mxchatAdmin.nonce |
| 10 |
}; |
| 11 |
|
| 12 |
$.post(mxchatAdmin.ajax_url, formData, function(response) { |
| 13 |
if (response.success) { |
| 14 |
$('#mxchat-license-status').text('Active'); |
| 15 |
} else { |
| 16 |
$('#mxchat-license-status').text('Inactive'); |
| 17 |
alert(response.data); |
| 18 |
} |
| 19 |
}); |
| 20 |
}); |
| 21 |
|
| 22 |
$('.nav-tab').on('click', function(e) { |
| 23 |
e.preventDefault(); |
| 24 |
$('.nav-tab').removeClass('nav-tab-active'); |
| 25 |
$(this).addClass('nav-tab-active'); |
| 26 |
$('.tab-content').removeClass('active').hide(); |
| 27 |
var activeTab = $(this).attr('href'); |
| 28 |
$(activeTab).addClass('active').show(); |
| 29 |
}); |
| 30 |
|
| 31 |
// Activate the first tab by default |
| 32 |
$('.nav-tab-active').trigger('click'); |
| 33 |
|
| 34 |
// Toggle visibility of API key |
| 35 |
$('#toggleApiKeyVisibility').on('click', function() { |
| 36 |
var apiKeyInput = $('#api_key'); |
| 37 |
if (apiKeyInput.attr('type') === 'password') { |
| 38 |
apiKeyInput.attr('type', 'text'); |
| 39 |
$(this).text('Hide'); |
| 40 |
} else { |
| 41 |
apiKeyInput.attr('type', 'password'); |
| 42 |
$(this).text('Show'); |
| 43 |
} |
| 44 |
}); |
| 45 |
|
| 46 |
// Toggle visibility of WooCommerce Consumer Secret |
| 47 |
$('#toggleWooCommerceSecretVisibility').on('click', function() { |
| 48 |
var secretInput = $('#woocommerce_consumer_secret'); |
| 49 |
if (secretInput.attr('type') === 'password') { |
| 50 |
secretInput.attr('type', 'text'); |
| 51 |
$(this).text('Hide'); |
| 52 |
} else { |
| 53 |
secretInput.attr('type', 'password'); |
| 54 |
$(this).text('Show'); |
| 55 |
} |
| 56 |
}); |
| 57 |
|
| 58 |
|
| 59 |
// Toggle visibility of Loops API Key |
| 60 |
$('#toggleLoopsApiKeyVisibility').on('click', function() { |
| 61 |
var loopsApiKeyInput = $('#loops_api_key'); |
| 62 |
if (loopsApiKeyInput.attr('type') === 'password') { |
| 63 |
loopsApiKeyInput.attr('type', 'text'); |
| 64 |
$(this).text('Hide'); |
| 65 |
} else { |
| 66 |
loopsApiKeyInput.attr('type', 'password'); |
| 67 |
$(this).text('Show'); |
| 68 |
} |
| 69 |
}); |
| 70 |
}); |
| 71 |
|