autosave only when the content changed

This commit is contained in:
Diego Najar 2018-10-21 15:00:15 +02:00
parent 62bcc0be74
commit ce3b22e3b9
6 changed files with 24 additions and 12 deletions

View File

@ -47,7 +47,7 @@ $numberOfPages = count($listOfFilesByPage);
<!-- Progress bar -->
<div class="progress mt-2">
<div id="jsbluditProgressBar" class="progress-bar bg-info" role="progressbar" style="width:0%"></div>
<div id="jsbluditProgressBar" class="progress-bar bg-primary" role="progressbar" style="width:0%"></div>
</div>
<!--
@ -115,7 +115,7 @@ function displayFiles(files) {
'<div>'+
'<button type="button" class="btn btn-primary btn-sm mr-2" onClick="editorInsertMedia(\''+image+'\'); closeMediaManager();"><?php $L->p('Insert') ?><\/button>'+
'<button type="button" class="btn btn-primary btn-sm" onClick="setCoverImage(\''+filename+'\'); closeMediaManager();"><?php $L->p('Set as cover image') ?><\/button>'+
'<button type="button" class="btn btn-secondary btn-sm float-right" onClick="deleteMedia(\''+filename+'\')"><?php $L->p('Delete') ?><\/button>'+
'<button type="button" class="btn btn-danger btn-sm float-right" onClick="deleteMedia(\''+filename+'\')"><?php $L->p('Delete') ?><\/button>'+
'<\/div>'+
'<\/td>'+
'<\/tr>';

View File

@ -474,15 +474,20 @@ $(document).ready(function() {
$("#jsform").submit();
});
// Autosave interval
// Autosave
// Autosave works when the content of the page is bigger than 100 characters
var currentContent = editorGetContent();
setInterval(function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val();
var content = editorGetContent();
var ajax = new bluditAjax();
// showAlert is the function to display an alert defined in alert.php
ajax.autosave(uuid, title, content, showAlert);
// Call autosave only when the user change the content
if (currentContent!=content) {
currentContent = content;
var ajax = new bluditAjax();
// showAlert is the function to display an alert defined in alert.php
ajax.autosave(uuid, title, content, showAlert);
}
},1000*60*AUTOSAVE_INTERVAL);
});

View File

@ -418,7 +418,7 @@ $(document).ready(function() {
$("#jsform").submit();
});
// Autosave interval
// Autosave
// Autosave works when the content of the page is bigger than 100 characters
setInterval(function() {
var uuid = $("#jsuuid").val();

View File

@ -96,7 +96,7 @@ define('SESSION_COOKIE_LIFE_TIME', 0);
$GLOBALS['ALERT_DISSAPEAR_IN'] = 3; // Seconds
// Number of images to show in the media manager per page
$GLOBALS['MEDIA_MANAGER_NUMBER_OF_FILES'] = 5;
$GLOBALS['MEDIA_MANAGER_NUMBER_OF_FILES'] = 2;
// Sort the image by date
$GLOBALS['MEDIA_MANAGER_SORT_BY_DATE'] = true;

View File

@ -359,9 +359,9 @@
"good-morning": "Buenos días",
"good-afternoon": "Buenas tardes",
"good-evening": "Buenas noches",
"good-night": "Good night",
"good-night": "Buenas noches",
"hello": "Hola",
"there-are-no-images-for-the-page": "There are no images for the page.",
"select-cover-image": "Select cover image",
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins."
"there-are-no-images-for-the-page": "No hay imágenes para la página.",
"select-cover-image": "Seleccionar imagen de portada",
"this-plugin-depends-on-the-following-plugins": "Este plugin depende de los siguientes plugins."
}

View File

@ -0,0 +1,7 @@
{
"plugin-data":
{
"name": "Contador de visitas",
"description": "Muestre el número de visitas o visitantes únicos en la barra lateral de su sitio."
}
}