diff options
Diffstat (limited to 'view/tpl/notes.tpl')
-rw-r--r-- | view/tpl/notes.tpl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/view/tpl/notes.tpl b/view/tpl/notes.tpl index b67f66f5b..3ec57ba12 100644 --- a/view/tpl/notes.tpl +++ b/view/tpl/notes.tpl @@ -1,8 +1,23 @@ <div class="widget"> <script> +var noteSaveTimer = null; $(document).on('focusout',"#note-text",function(e){ - $.post('notes', { 'note_text' : $('#note-text').val() }); + if(noteSaveTimer) + clearTimeout(noteSaveTimer); + noteSaveChanges(); + if(noteSaveTimer) + clearTimeout(noteSaveTimer); + noteSaveTimer = null; +}); + +$(document).on('focusin',"#note-text",function(e){ + noteSaveTimer = setTimeout(noteSaveChanges,10000); }); + +function noteSaveChanges() { + $.post('notes', { 'note_text' : $('#note-text').val() }); + noteSaveTimer = setTimeout(noteSaveChanges,10000); +} </script> <h3>{{$banner}}</h3> |