Improve Autosave

This commit is contained in:
danpros 2024-05-27 07:37:53 +07:00
commit a813ed3b38
10 changed files with 308 additions and 393 deletions

View file

@ -1,16 +0,0 @@
.notice {
position: fixed;
bottom: 20px;
right: 20px;
padding: 10px 20px;
background-color: #f0f9ff;
border: 1px solid #e0e0e0;
border-radius: 5px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
font-size: 14px;
color: #333;
z-index: 999;
display: flex;
align-items: center;
display: none;
}

View file

@ -16,6 +16,7 @@ function updateData() {
var pDate = $("#pDate").val();
var pTime = $("#pTime").val();
var dateTime = pDate + " " + pTime;
var autoSave = 'autoSave';
// Prepare data to send to PHP
var data = {
@ -27,31 +28,35 @@ function updateData() {
category: category,
posttype: posttype,
pimage: pimage,
paudio: paudio,
pvideo: pvideo,
pquote: pquote,
plink: plink,
dateTime: dateTime
paudio: paudio,
pvideo: pvideo,
pquote: pquote,
plink: plink,
dateTime: dateTime,
autoSave: autoSave,
addEdit: addEdit,
oldfile: oldfile,
parent_page: parent_page
};
$.ajax({
url: base_path + 'autosave.php',
url: base_path + 'admin/autosave',
type: "POST",
data: data,
success: function(response) {
$("#response").html(response);
$("#response").fadeIn(600, function() {
$("#response").fadeIn(600, function() {
$("#response").css("display", "block");
});
setTimeout(function() {
$("#response").fadeOut(600, function() {
});
setTimeout(function() {
$("#response").fadeOut(600, function() {
$("#response").css("display", "none");
});
}, 3000);
}, 3000);
}
});
}
$(document).ready(function() {
setInterval(updateData, 60000);
setInterval(updateData, saveInterval);
});