Files
eveAI/integrations/Wordpress/eveai_sync/admin/js/eveai_admin.js
Josako 9e14824249 - Furter refinement of the API, adding functionality for refreshing documents and returning Token expiration time when retrieving token
- Implementation of a first version of a Wordpress plugin
- Adding api service to nginx.conf
2024-09-11 16:31:13 +02:00

49 lines
1.6 KiB
JavaScript

jQuery(document).ready(function($) {
// Handle bulk sync button click
$('#eveai-bulk-sync').on('click', function(e) {
e.preventDefault();
if (confirm('Are you sure you want to start a bulk sync? This may take a while.')) {
$.ajax({
url: ajaxurl,
type: 'POST',
data: {
action: 'eveai_bulk_sync',
nonce: eveai_admin.nonce
},
success: function(response) {
alert(response.data.message);
},
error: function() {
alert('An error occurred. Please try again.');
}
});
}
});
// Handle category exclusion checkboxes
$('.eveai-category-exclude').on('change', function() {
var categoryId = $(this).val();
var isExcluded = $(this).is(':checked');
$.ajax({
url: ajaxurl,
type: 'POST',
data: {
action: 'eveai_toggle_category_exclusion',
category_id: categoryId,
is_excluded: isExcluded ? 1 : 0,
nonce: eveai_admin.nonce
},
success: function(response) {
if (response.success) {
console.log('Category exclusion updated');
} else {
alert('Failed to update category exclusion');
}
},
error: function() {
alert('An error occurred. Please try again.');
}
});
});
});