- Implementation of a first version of a Wordpress plugin - Adding api service to nginx.conf
49 lines
1.6 KiB
JavaScript
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.');
|
|
}
|
|
});
|
|
});
|
|
}); |