diff options
-rw-r--r-- | mod/notes.php | 8 | ||||
-rw-r--r-- | view/tpl/notes.tpl | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/mod/notes.php b/mod/notes.php index 468b4ef26..e21e4386c 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -10,6 +10,14 @@ function notes_init(&$a) { $body = escape_tags($_REQUEST['note_text']); set_pconfig(local_user(),'notes','text',$body); } + + // push updates to channel clones + + if((argc() > 1) && (argv(1) === 'sync')) { + require_once('include/zot.php'); + build_sync_packet(); + } + logger('notes saved.'); json_return_and_die($ret); diff --git a/view/tpl/notes.tpl b/view/tpl/notes.tpl index 3ec57ba12..0e8c8017c 100644 --- a/view/tpl/notes.tpl +++ b/view/tpl/notes.tpl @@ -4,9 +4,7 @@ var noteSaveTimer = null; $(document).on('focusout',"#note-text",function(e){ if(noteSaveTimer) clearTimeout(noteSaveTimer); - noteSaveChanges(); - if(noteSaveTimer) - clearTimeout(noteSaveTimer); + notePostFinal(); noteSaveTimer = null; }); @@ -14,6 +12,10 @@ $(document).on('focusin',"#note-text",function(e){ noteSaveTimer = setTimeout(noteSaveChanges,10000); }); +function notePostFinal() { + $.post('notes/sync', { 'note_text' : $('#note-text').val() }); +} + function noteSaveChanges() { $.post('notes', { 'note_text' : $('#note-text').val() }); noteSaveTimer = setTimeout(noteSaveChanges,10000); |