final tweaks with save indicator
This commit is contained in:
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user