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 --> <!-- Progress bar -->
<div class="progress mt-2"> <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> </div>
<!-- <!--
@ -115,7 +115,7 @@ function displayFiles(files) {
'<div>'+ '<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 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-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>'+ '<\/div>'+
'<\/td>'+ '<\/td>'+
'<\/tr>'; '<\/tr>';

View File

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

View File

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

View File

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

View File

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