Changes to icon importer

This commit is contained in:
Jeremy Rangel
2024-12-30 02:31:16 -08:00
parent 0d59719440
commit 28139d2455
9 changed files with 4424 additions and 4243 deletions

68
assets/js/icon-import.js Normal file
View File

@ -0,0 +1,68 @@
document.addEventListener('DOMContentLoaded', function () {
const installButtons = document.querySelectorAll('.install-btn');
const uninstallButtons = document.querySelectorAll('.uninstall-btn');
// Handle Install button click
installButtons.forEach(function (button) {
button.addEventListener('click', function () {
console.log('Install button clicked');
const iconSetId = this.getAttribute('data-icon-set-id');
console.log('Icon Set ID:', iconSetId);
const formData = new FormData();
formData.append('action', 'install_icon_set');
formData.append('icon_set_id', iconSetId);
const xhr = new XMLHttpRequest();
xhr.open('POST', mytheme_ajax.ajax_url, true);
xhr.onload = function () {
if (xhr.status === 200) {
const response = JSON.parse(xhr.responseText);
console.log(response);
if (response.success) {
alert('Icon set installed successfully!');
} else {
alert('Failed to install icon set: ' + response.data.message);
}
} else {
alert('There was an error with the request.');
}
};
xhr.send(formData);
});
});
// Handle Uninstall button click
uninstallButtons.forEach(function (button) {
button.addEventListener('click', function () {
console.log('Uninstall button clicked');
const iconSetId = this.getAttribute('data-icon-set-id');
console.log('Icon Set ID for uninstall:', iconSetId);
const formData = new FormData();
formData.append('action', 'uninstall_icon_set');
formData.append('icon_set_id', iconSetId);
const xhr = new XMLHttpRequest();
xhr.open('POST', mytheme_ajax.ajax_url, true);
xhr.onload = function () {
if (xhr.status === 200) {
const response = JSON.parse(xhr.responseText);
console.log(response);
if (response.success) {
alert('Icon set uninstalled successfully!');
} else {
alert('Failed to uninstall icon set: ' + response.data.message);
}
} else {
alert('There was an error with the request.');
}
};
xhr.send(formData);
});
});
});

View File

@ -4,7 +4,7 @@
"setName": "Font Awesome - Regular",
"setFamily": "Font Awesome",
"version": "6.7.1",
"file": "/font-awesome/v6.1.7/font-awesome-v6.7.1-regular-svgs.json"
"file": "/font-awesome/v6.7.1/font-awesome-v6.7.1-regular-svgs.json"
},
{
@ -12,7 +12,7 @@
"setName": "Font Awesome - Solid",
"setFamily": "Font Awesome",
"version": "6.7.1",
"fileName": "/font-awesome/v6.1.7/font-awesome-v6.7.1-solid-svgs.json"
"fileName": "/font-awesome/v6.7.1/font-awesome-v6.7.1-solid-svgs.json"
},
{
@ -20,7 +20,7 @@
"setName": "Font Awesome - Brands",
"setFamily": "Font Awesome",
"version": "6.7.1",
"fileName": "/font-awesome/v6.1.7/font-awesome-v6.7.1-brands-svgs.json"
"fileName": "/font-awesome/v6.7.1/font-awesome-v6.7.1-brands-svgs.json"
},
{

File diff suppressed because one or more lines are too long