push notes widget updates to channel clones on focusout (final save). Don't do this for the auto-save events (every ten seconds) which could generate superfluous network traffic.
This commit is contained in:
parent
9bb7811d74
commit
a798dd767d
@ -10,6 +10,14 @@ function notes_init(&$a) {
|
|||||||
$body = escape_tags($_REQUEST['note_text']);
|
$body = escape_tags($_REQUEST['note_text']);
|
||||||
set_pconfig(local_user(),'notes','text',$body);
|
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.');
|
logger('notes saved.');
|
||||||
json_return_and_die($ret);
|
json_return_and_die($ret);
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@ var noteSaveTimer = null;
|
|||||||
$(document).on('focusout',"#note-text",function(e){
|
$(document).on('focusout',"#note-text",function(e){
|
||||||
if(noteSaveTimer)
|
if(noteSaveTimer)
|
||||||
clearTimeout(noteSaveTimer);
|
clearTimeout(noteSaveTimer);
|
||||||
noteSaveChanges();
|
notePostFinal();
|
||||||
if(noteSaveTimer)
|
|
||||||
clearTimeout(noteSaveTimer);
|
|
||||||
noteSaveTimer = null;
|
noteSaveTimer = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -14,6 +12,10 @@ $(document).on('focusin',"#note-text",function(e){
|
|||||||
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function notePostFinal() {
|
||||||
|
$.post('notes/sync', { 'note_text' : $('#note-text').val() });
|
||||||
|
}
|
||||||
|
|
||||||
function noteSaveChanges() {
|
function noteSaveChanges() {
|
||||||
$.post('notes', { 'note_text' : $('#note-text').val() });
|
$.post('notes', { 'note_text' : $('#note-text').val() });
|
||||||
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
||||||
|
Reference in New Issue
Block a user