autosave only when the content changed

This commit is contained in:
Diego Najar 2018-10-09 18:59:05 +02:00
parent c3911d7f29
commit 6a3609098f

View File

@ -416,13 +416,16 @@ $(document).ready(function() {
// Autosave interval
// 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);
if (currentContent!=content) {
// showAlert is the function to display an alert defined in alert.php
ajax.autosave(uuid, title, content, showAlert);
}
},1000*60*AUTOSAVE_INTERVAL);
// Template autocomplete