Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,194 @@
jQuery(document).ready(function () {
//selectpicker global jquery
// jQuery('select').selectpicker();
//tooltip
// tippy('[data-toggle="tooltip"]');
//Datepicker Jquery
// jQuery('#from-date').datepicker({
// dateFormat: 'yy-mm-dd',
// }).on('change', function(){
// $('.datepicker').hide();
// });
// jQuery('#to-date').datepicker({
// dateFormat: 'yy-mm-dd',
// }).on('change', function(){
// $('.datepicker').hide();
// });
// jQuery('input[data-type="date"]')
// .datepicker({
// dateFormat: 'dd/mm/yyyy'
// })
// .on('change', function() {
// $('.datepicker').hide();
// });
//Icheck Jquery
// jQuery('input[type=radio]:not(".noicheck"), input[type=checkbox]:not(".noicheck,.ios-switch")').iCheck({
// checkboxClass: 'icheckbox_square-green',
// radioClass: 'iradio_square-green',
// increaseArea: '20%' // optional
// });
jQuery("#upgrade_notices_csv_bro").click(function () {
// jQuery.ajax({
// type: "post",
// url: ajaxurl, //this is wordpress ajax file which is already avaiable in wordpress
// data: {
// action:'upgrade_notices_csv_bro' //this value is first parameter of add_action
// },
// success: function(msg){
// console.log(msg);
// }
// });
jQuery.ajax({
type: "post",
url: window.smack_nonce_object.url, // Use the URL from the localized object
data: {
action: "upgrade_notices_csv_bro",
nonce: window.smack_nonce_object.url, // Include the nonce in the data
},
success: function (msg) {
location.reload();
},
});
});
// Setting Page Slide Menu jQuery
jQuery(".setting-tab-list").click(function () {
jQuery(this).siblings().removeClass("active");
jQuery(this).addClass("active");
var data = jQuery(this).data("setting");
jQuery("." + data)
.siblings()
.removeClass("active");
jQuery("." + data).addClass("active");
});
jQuery(".custom-fields-tab-list").click(function () {
jQuery(this).siblings().removeClass("active");
jQuery(this).addClass("active");
var data = jQuery(this).data("tab");
jQuery("." + data)
.siblings()
.removeClass("active");
jQuery("." + data).addClass("active");
});
jQuery(".browse-btn").click(function () {
alert("hai");
jQuery(".drop_file").trigger("click");
});
// jQuery('.advanced-filter input[type="checkbox"]').on('change', function(){
// alert('');
// });
jQuery('.advanced-filter input[type="checkbox"]').on(
"ifChecked",
function () {
jQuery(this).parent().parent().siblings(".row").slideDown();
}
);
jQuery('.advanced-filter input[type="checkbox"]').on(
"ifUnchecked",
function () {
jQuery(this).parent().parent().siblings(".row").slideUp();
}
);
jQuery(".split-record").on("ifChecked", function () {
jQuery(this).parent().parent().siblings("input").show();
});
jQuery(".split-record").on("ifUnchecked", function () {
jQuery(this).parent().parent().siblings("input").hide();
});
jQuery('.custom-size input[type="checkbox"]')
.on("ifChecked", function () {
jQuery(".custom-image-sizes").slideDown();
})
.on("ifUnchecked", function () {
jQuery(".custom-image-sizes").slideUp();
});
jQuery(".btn-add-size").on("click", function () {
var clone_row = jQuery(
"table.media-handle-image-size tbody tr#original-row"
).clone();
jQuery(clone_row).removeAttr("id");
jQuery(clone_row).children().children(".form-control").removeAttr("value");
jQuery(clone_row).appendTo("table.media-handle-image-size tbody");
jQuery("table.media-handle-image-size tbody tr td.delete").on(
"click",
function () {
var row_length = jQuery(
"table.media-handle-image-size tbody tr"
).length;
if (row_length > 1) {
jQuery(this).parent().remove();
} else {
return;
}
}
);
});
jQuery("#media-handle").on("change", function () {
if (jQuery(this).is(":checked")) {
jQuery(".media-fields").addClass("active");
} else {
jQuery(".media-fields").removeClass("active");
}
});
jQuery(".table-mapping .action-icon").on("click", function () {
jQuery(".manipulation-screen").removeClass("active");
jQuery(this).children(".manipulation-screen").addClass("active");
// jQuery(this).children('.manipulation-screen').show();
});
jQuery(".manipulation-screen .close").on("click", function () {
// console.log('clicked');
jQuery(this).parent().removeClass("active");
// console.log('here');
});
// open calender when click icon
jQuery(".input-icon").on("click", function () {
jQuery(this).siblings(".form-control").focus();
});
dragableDroppable();
});
// mapping accordon jQuery
function toggle_func(id) {
jQuery("#" + id + "-body").slideToggle("slow");
//jQuery('#icon'+id).toggleClass("icon-circle-down").toggleClass("icon-circle-up");
jQuery("#" + id).toggleClass("bg-white active");
jQuery("#" + id + " span").toggleClass("active");
}
// Dragable JS (Advance Mapping Page)
var dragableDroppable = function () {
jQuery(".draggable").draggable({
//revert: true,
helper: "clone",
containment: "document",
helper: function () {
return jQuery(this).clone().appendTo("body").css({
zIndex: 5,
});
},
start: function (event, ui) {
jQuery(this).fadeTo("fast", 0.5);
},
stop: function (event, ui) {
jQuery(this).fadeTo(0, 1);
},
});
jQuery(".droppable").droppable({
hoverClass: "active",
drop: function (event, ui) {
this.value += "{" + jQuery(ui.draggable).text() + "}";
},
});
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
jQuery(document).ready(function(){
document.getElementById('click_get_started').onclick = function () {
jQuery(this).html('<img src = ' + `${window.smack_nonce_object.imagePath}ajax-loader.gif`+ '>');
var addons = ['Users','WooCommerce','Exporter'];
jQuery.ajax({
type: 'POST',
url: smack_nonce_object.url,
data: {
'action' : 'install_plugins',
'addons' : addons,
'securekey' : smack_nonce_object.nonce,
},
success: function(data){
window.location.replace(window.location.origin + ajaxurl+ '/../admin.php?page=com.smackcoders.csvimporternew.menu');
},
error: function(errorThrown){
}
});
}
$("#Useraddon").click(function() {
jQuery(this).html('<img src = ' + `${window.smack_nonce_object.imagePath}ajax-loader.gif`+ '>');
jQuery.ajax({
type: 'POST',
url: smack_nonce_object.url,
data: {
'action' : 'install_addon',
'addons' : 'Users',
'securekey' : smack_nonce_object.nonce,
},
success: function(response){
$("#Useraddon").html('Activated');
},
error: function(errorThrown){
}
});
});
$("#WooCommerceaddon").click(function() {
jQuery(this).html('<img src = ' + `${window.smack_nonce_object.imagePath}ajax-loader.gif`+ '>');
jQuery.ajax({
type: 'POST',
url: smack_nonce_object.url,
data: {
'action' : 'install_addon',
'addons' : 'WooCommerce',
'securekey' : smack_nonce_object.nonce,
},
success: function(response){
$("#WooCommerceaddon").html('Activated');
},
error: function(errorThrown){
}
});
});
$("#Exporteraddon").click(function() {
jQuery(this).html('<img src = ' + `${window.smack_nonce_object.imagePath}ajax-loader.gif`+ '>');
jQuery.ajax({
type: 'POST',
url: smack_nonce_object.url,
data: {
'action' : 'install_addon',
'addons' : 'Exporter',
'securekey' : smack_nonce_object.nonce,
},
success: function(response){
$("#Exporteraddon").html('Activated');
},
error: function(errorThrown){
}
});
});
});

View File

@@ -0,0 +1,221 @@
function showSubmit(){
var reason = document.getElementsByName('selected-reason')
for(i = 0; i < reason.length; i++) {
if(reason[i].checked){
if(reason[i].value == 1){
document.getElementById('input-reason2').style.display="none"
document.getElementById('input-reason5').style.display="none"
}else if(reason[i].value == 2){
document.getElementById('input-reason2').style.display="block"
document.getElementById('input-reason2').focus();
document.getElementById('input-reason5').style.display="none"
}else if(reason[i].value == 3){
document.getElementById('input-reason2').style.display="none"
document.getElementById('input-reason5').style.display="none"
}else if(reason[i].value == 4){
document.getElementById('input-reason2').style.display="none"
document.getElementById('input-reason5').style.display="none"
}else if(reason[i].value == 5){
document.getElementById('input-reason5').style.display="block"
document.getElementById('input-reason5').focus();
document.getElementById('input-reason2').style.display="none"
}
}
}
document.getElementById('skipanddeactivate').style.display="none";
document.getElementById('mailsubmit').setAttribute('style','margin-right:10px;');
}
function hideSubmit(){
document.getElementById('mailsubmit').style.display="none";
document.getElementById('skipanddeactivate').setAttribute('style','margin-right:10px;');
}
function submitReason(){
var mailReason = ""
var reason = document.getElementsByName('selected-reason')
for(i = 0; i < reason.length; i++) {
if(reason[i].checked){
if(reason[i].value == 1){
mailReason = "The plugin did not work"
}else if(reason[i].value == 2){
mailReason = "I found a better plugin.\n"
var iReason = document.getElementById('input-reason2');
if(iReason.value == ""){
alert("Please Enter the plugin name!")
iReason.focus();
return false;
}else{
mailReason += iReason.value;
}
}else if(reason[i].value == 3){
mailReason = "I do not like to share my information with you"
}else if(reason[i].value == 4){
mailReason = "It is a temporary deactivation. I am just debugging an issue"
}else if(reason[i].value == 5){
mailReason = "Reason type : Other.\n"
var iReason = document.getElementById('input-reason5');
if(iReason.value == ""){
alert("Please Enter the reason to deactivate this plugin!")
iReason.focus();
return false;
}else{
mailReason += iReason.value;
}
}
}
}
document.getElementById('myModal').style.display='none'
document.getElementById("loader").style.display = 'block';
var formData = new FormData();
formData.append('action', 'DeactivateMail');
formData.append('reason', mailReason);
formData.append("securekey", window.smack_nonce_object.nonce);
var xhttp = new XMLHttpRequest();
xhttp.open("POST",ajaxurl,true);
xhttp.send(formData);
xhttp.onreadystatechange = function() {
if (xhttp.readyState === 4) {
document.getElementById("skipanddeactivate").click();
document.getElementById("loader").style.display = 'none';
}
}
return true;
}
window.onload = function(){
var popUp = document.querySelector('[data-slug="wp-ultimate-csv-importer"] .deactivate a');
if (typeof(popUp) != 'undefined' && popUp != null){
var urlRedirect = popUp.getAttribute('href');
popUp.onclick = function(event){
event.preventDefault()
var removeModal = document.getElementById("myModal");
if (typeof(removeModal) != 'undefined' && removeModal != null){
}else{
popupModal();
}
document.getElementById('myModal').style.display='block'
}
}
function popupModal(){
var loaderdiv = document.createElement('div');
loaderdiv.setAttribute('id','loader');
document.body.appendChild(loaderdiv);
var maindiv = document.createElement('div');
maindiv.setAttribute('id','myModal');
maindiv.setAttribute('class','myModal');
document.body.appendChild(maindiv);
var modalContent = document.createElement("div");
modalContent.setAttribute('class','modal-content');
maindiv.appendChild(modalContent);
var header = document.createElement("div")
header.setAttribute('style','display:flex;align-items:center;justify-content:space-between;')
var headerhead = document.createElement("h3");
var headerheadS = document.createElement("strong");
headerheadS.innerHTML = "Quick Feedback";
headerhead.appendChild(headerheadS);
header.appendChild(headerhead);
var close = document.createElement("span");
close.setAttribute('class',"close-button");
close.setAttribute('onclick',"document.getElementById('myModal').style.display='none'")
close.innerHTML = "×";
header.appendChild(close);
modalContent.appendChild(header);
var body = document.createElement('div');
body.setAttribute('class','card cardView');
modalContent.appendChild(body);
var bodyhead = document.createElement("h4");
var bodyheadS = document.createElement("strong");
bodyheadS.innerHTML = "If you have a moment, please let us know why you are deactivating:";
bodyhead.appendChild(bodyheadS);
body.appendChild(bodyhead);
var ul = document.createElement("ul");
body.appendChild(ul);
var li = [];
var br = [];
var label = [];
var span = [];
var input = [];
var inputReason = [];
var spanContent = [];
for (i = 1; i <= 5; i++) {
li[i] = document.createElement("li");
ul.appendChild(li[i]);
label[i] = document.createElement("label");
li[i].appendChild(label[i]);
span[i] = document.createElement("span");
label[i].appendChild(span[i]);
input[i] = document.createElement("input");
input[i].setAttribute('type','radio');
input[i].setAttribute('name','selected-reason');
input[i].setAttribute('id','selected-reason'+i);
input[i].setAttribute('value',i);
input[i].setAttribute('onchange','showSubmit()');
span[i].appendChild(input[i]);
br[i] = document.createElement("br");
li[i].appendChild(br[i]);
inputReason[i] = document.createElement("input");
inputReason[i].setAttribute('type','text');
inputReason[i].setAttribute('id','input-reason'+i);
inputReason[i].setAttribute('name','input-reason'+i);
inputReason[i].setAttribute('style','display:none;margin-left:20px;margin-top:10px;margin-bottom:5px;width:70%;');
li[i].appendChild(inputReason[i]);
spanContent[i] = document.createElement("span");
label[i].appendChild(spanContent[i]);
}
document.getElementById('input-reason2').setAttribute('placeholder',"What's the plugin's name?")
document.getElementById('input-reason5').setAttribute('placeholder',"Kindly tell us the reason so we can improve?")
spanContent[1].innerHTML = "The plugin didn't work";
spanContent[2].innerHTML = "I found a better plugin";
spanContent[3].innerHTML = "I don't like to share my information with you";
spanContent[4].innerHTML = "It's a temporary deactivation. I'm just debugging an issue";
spanContent[5].innerHTML = "Other";
var footer = document.createElement("div");
footer.setAttribute('style','float:right');
modalContent.appendChild(footer);
var submitBtn = document.createElement('input');
submitBtn.setAttribute('type','button');
submitBtn.setAttribute('id','mailsubmit');
submitBtn.setAttribute('name','mailsubmit');
submitBtn.setAttribute('class','button button-secondary button-deactivate allow-deactivate');
submitBtn.setAttribute('value','Submit & Deactivate');
submitBtn.setAttribute('onclick','submitReason()')
submitBtn.setAttribute('style','display:none;margin-right:10px;');
footer.appendChild(submitBtn);
var skipBtn = document.createElement('a');
skipBtn.setAttribute('id','skipanddeactivate');
skipBtn.setAttribute('class','button button-secondary button-deactivate allow-deactivate');
skipBtn.setAttribute('style','margin-right:10px;');
skipBtn.setAttribute('href',urlRedirect)
skipBtn.innerHTML = "Skip &amp; Deactivate";
footer.appendChild(skipBtn);
var cancelBtn = document.createElement('span');
cancelBtn.setAttribute('class','button button-secondary button-close');
cancelBtn.setAttribute('onclick',"document.getElementById('myModal').style.display='none'");
cancelBtn.innerHTML = "Cancel";
footer.appendChild(cancelBtn);
}
}

View File

@@ -0,0 +1,283 @@
jQuery(document).ready(function ($) {
function checkEditorHeader() {
const editorHeader = $('.editor-header__settings');
if (editorHeader.length > 0) {
clearInterval(editorHeaderInterval);
const importExportButton = $(
`<button class="import-export-btn" title="Import/Export" style="display: flex; align-items: center; justify-content: center; gap: 6px; background-color: #e1f0ff; border: 1px solid #007cba; color: #007cba; padding: 5px 18px 4px 10px; cursor: pointer; border-radius: 2px; font-size: 12px;">
<div style="rotate:270deg; font-size: 20px; color: #007cba;">&#8651;</div>
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<span class="button-text" style="font-size: 8px; font-weight: bold; text-align: center; color: #007cba;">Import</span>
<hr class="separator" style="width: 100%; border: 0; border-top: 1px solid #007cba; margin: 2px 0;">
<span class="button-text" style="font-size: 8px; font-weight: bold; text-align: center; color: #007cba;">Export</span>
</div>
</button>`
);
const slider = $(
`<div class="right-slider" style="position: absolute; right: 0; width: 280px; height: calc(100vh - 65px); background: #fff; box-shadow: -2px 6px 10px rgba(0, 0, 0, 0.2); overflow: auto; transition: transform 0.3s ease; transform: translateX(100%); z-index: 10000;">
<div class="slider-header" style="position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ccc; margin-top: 5px;">
<div class="tabs" style="display: flex; gap: 10px;">
<button class="tab" style="background: none; border: none; cursor: pointer; padding:1rem; border-bottom: 2px solid #007cba; font-weight: 500;">Import</button>
<button class="tab" style="background: none; border: none; cursor: pointer; padding:1rem 10px; border-bottom: 2px solid transparent; font-weight: 500;">Export</button>
</div>
<span class="close-slider" style="cursor: pointer; font-size: 25px; margin-right: 10px;">&times;</span>
</div>
<div class="slider-content" style="padding: 15px; color: #333; height: calc(100% - 91px); position: relative;">
<div class="tab-content import-content">
<p>Import options go here. You can import your CSV file using the options provided.</p>
<input type="file" id="import-file" name="import-file" accept=".csv" style="display: inline-block; margin-top: 1rem; width: 100%; padding: 1rem 8px; background-color: #eee; border-radius: 4px; box-shadow: 0 0 2px #888;">
<div class="loading-bar" style="display: none; margin-top: 10px; width: 100%; background-color: #EDEDED; border-radius: 10px; height: 5px;">
<div style="width: 0%; height: 100%; background-color: #007cba; border-radius: 10px;" id="loading-progress"></div>
</div>
<small id="import-status" style="margin-top: 10px; display: none; color: #017C01; text-align: right;"></small>
<button id="upload-import-btn" style="display: none; margin: 20px auto 0; background-color: #007cba; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;">Upload Import</button>
<button id="clear-btn" style="display: none; margin: 20px auto 0; background-color: #007cba; margin-left:83px; color: white; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer;">clear</button>
<small id="smack-imp-message" style=" display: none; color:#FF0000; text-align: right; "></small>
<p id="smack-message" style="margin-top: 25px; display: none; inline-block; background-color:#eee; padding: 1rem 8px; border: 2px solid #DCDCDC; border-radius: 8px; color: #333; height:50px; width: 230px;"></p>
</div>
<div class="tab-content export-content" style="display: none;">
<p>Export options go here. You can export your CSV file using the options provided.</p>
<button id="export-btn" style="margin: 20px auto 0; display: block; background-color: #007cba; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;margin-bottom:16px">Export CSV</button>
<small id="smack-exp-message" style=" display: none; color:#FF0000; text-align: right; "></small>
</div>
</div>
</div>`
);
const sliders = $('.interface-navigable-region.interface-interface-skeleton__sidebar');
sliders.append(slider);
let totalChildren = editorHeader.children().length;
editorHeader.children().eq(totalChildren - 3).after(importExportButton);
$('.import-export-btn').on('click', function () {
$('.right-slider').css({
'transform': 'translateX(0)',
'z-index': '10000',
});
$('.interface-navigable-region.interface-interface-skeleton__sidebar').css({
'width': '280px'
});
});
$('.right-slider').on('click', '.close-slider', function () {
$('.right-slider').css({
'transform': 'translateX(100%)',
'z-index': '10',
});
$('.interface-navigable-region.interface-interface-skeleton__sidebar').css({
'width': ''
});
});
$(document).on('click', function (event) {
if (!$(event.target).closest('.right-slider, .import-export-btn').length) {
if ($('.right-slider').css('transform') !== 'translateX(0px)') {
$('.right-slider').css({
'transform': 'translateX(100%)',
'z-index': '10',
});
$('.interface-navigable-region.interface-interface-skeleton__sidebar').css({
'width': ''
});
}
}
});
$('.tab').on('click', function () {
$('.tab').css('border-bottom', '2px solid transparent');
$(this).css('border-bottom', '2px solid #007cba');
const index = $(this).index();
$('.tab-content').hide();
$('.tab-content').eq(index).show();
});
$('#import-file').on('change', function () {
const fileName = $(this).val().split('\\').pop();
if (!fileName) {
$('#upload-import-btn').hide();
return;
}
$('.loading-bar').show();
$('#import-status').hide();
$('#upload-import-btn').hide().prop('disabled', true);
let truncatedFileName = fileName;
if (fileName.length > 10) {
truncatedFileName = fileName.substring(0, 10) + '...csv';
}
$('#import-status').show().text(`Importing ${truncatedFileName}`).css('color', '#017C01');
let progress = 0;
const interval = setInterval(function () {
progress += 10;
$('#loading-progress').css('width', progress + '%');
if (progress >= 100) {
clearInterval(interval);
$('#import-status').text(`Success!`).css('color', '#017C01');
$('#upload-import-btn')
.prop('disabled', false)
.css({
'margin-top': '20px',
'display': 'block',
})
.show();
}
}, 200);
});
$('#upload-import-btn').on('click', function () {
const fileInput = $('#import-file')[0];
const file = fileInput.files[0];
if (!file) {
console.error("No file selected.");
$('#import-status').text("No file selected. Please choose a file.").css('color', '#FF0000');
return;
}
const postId = wp.data.select('core/editor').getCurrentPostId();
const formData = new FormData();
formData.append('action', 'handle_import_csv');
formData.append('file', file);
formData.append('post_id', postId);
formData.append('securekey' , smack_nonce_object.nonce),
$('#upload-import-btn').prop('disabled', true).text('Uploading...').css({
'background-color': '#ccc',
'cursor': 'not-allowed',
});
$.ajax({
url: ajaxurl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (response) {
try {
const data = JSON.parse(response) || response;
if (data.success || response.success) {
$('#smack-message').show().text(data.message).css('color', '#FFFFF');
$('#import-file').prop('disabled', true);
$('#import-file').next().hide();
$('#upload-import-btn').hide();
$('#clear-btn').show();
$('#import-status').hide();
$('#smack-message').append(`
<p>
<a href="${data.redirect_link}" target="_blank" style="color: #007cba; text-decoration: none; font-weight: bold;">
Click here
</a> for Redirect link
</p>
`);
} else if (!data.success || !response.success) {
$('#smack-imp-message').show().text(response.data.message || data.message).css('color', '#FFFFF');
} else {
$('#smack-imp-message').show().text("Something Went to wrong" + response.data.message || data.message).css('color', '#FFFFF');
}
} catch (e) {
console.error("Error parsing JSON response:", e);
$('#import-status').text("Upload Failed. Invalid response format.").css('color', '#FF0000');
} finally {
$('#upload-import-btn').prop('disabled', false).text('Upload Import').css({
'background-color': '#007cba',
'cursor': 'pointer',
});
}
},
error: function (xhr, status, error) {
console.error("AJAX Error:", error);
$('#import-status').text("Upload Failed. Please try again.").css('color', '#FF0000');
$('#upload-import-btn').prop('disabled', false).text('Upload Import').css({
'background-color': '#007cba',
'cursor': 'pointer',
});
}
});
});
$('#export-btn').on('click', function () {
const postId = wp.data.select('core/editor').getCurrentPostId();
const postTitle = wp.data.select('core/editor').getEditedPostAttribute('title');
$.ajax({
url: ajaxurl,
type: 'POST',
data: {
action: 'handle_export_csv',
post_id: postId,
post_title: postTitle,
securekey : smack_nonce_object.nonce,
},
success: function (response) {
console.log('response', 'color: #0088cc', typeof (response));
try {
// Check if response is a string and parse it if needed
const data = (typeof response === 'string') ? JSON.parse(response) : response;
if (data.success) {
const filePath = data.file_path;
const fileName = filePath.split('/').pop();
const downloadLink = document.createElement('a');
downloadLink.href = filePath;
downloadLink.download = fileName;
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
} else if (!data.success) {
$('#smack-exp-message').show().text(response.data.message || data.message).css('color', '#FFFFF');
} else {
$('#smack-exp-message').show().text(data.message || "Something went wrong").css('color', '#FFFFF');
}
} catch (e) {
console.error("Error parsing JSON response:", e);
$('#smack-exp-message').show().text("Error parsing response").css('color', '#FFFFF');
}
},
error: function (xhr, status, error) {
console.error("AJAX Error:", error);
}
});
});
$('#clear-btn').on('click', function () {
$('#import-file').val('');
$('#smack-message').text('')
$('#import-status').text('');
$('#smack-message').hide();
$('#clear-btn').hide();
$('#upload-import-btn').show();
$('#import-file').prop('disabled', false);
});
const customStyles = `
.import-export-btn:hover svg {
fill: #006799;
}
.tab:hover {
color: #007cba;
border-bottom: 2px solid #007cba;
}
.slider-header .close-slider:hover {
color: #007cba;
}
`;
$('head').append(`<style>${customStyles}</style>`);
}
}
const editorHeaderInterval = setInterval(checkEditorHeader, 500);
});