final tweaks with save indicator

This commit is contained in:
2022-11-30 21:33:41 -05:00
parent 1348f73400
commit 5b3b6711d9
3 changed files with 35 additions and 11 deletions

View File

@ -9,7 +9,11 @@
type: 'POST'
}).done(function (data) {
// saved!
// show 'saved' indicator
$('#saved-indicator').addClass('show').delay(800).queue(function (next) {
$(this).removeClass('show');
next();
});
}).fail(function () {
alert('Could not connect to server. Check your internet connection and try again.');
@ -18,13 +22,16 @@
$(function () {
// bind on blur event
$('textarea').on('blur', function () {
saveContent($(this));
var timer = null;
$('textarea').keyup(function () {
clearTimeout(timer);
timer = setTimeout(function () {
saveContent();
}, 500);
});
// 20 second interval
setInterval(saveContent, 20000);
setInterval(saveContent, 60000);
//onbeforeunload = saveContent();