aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-04-01 14:52:47 -0700
committerfriendica <info@friendica.com>2014-04-01 14:52:47 -0700
commit6ba32d714dd40c530aa40d1ae25dddb25a262a36 (patch)
treed9cf73f2f69c8ad9d217772ba5983fc8312b542a /view/tpl
parent78d7425a1d9de91343c60be1d0f0a467a674d84d (diff)
downloadvolse-hubzilla-6ba32d714dd40c530aa40d1ae25dddb25a262a36.tar.gz
volse-hubzilla-6ba32d714dd40c530aa40d1ae25dddb25a262a36.tar.bz2
volse-hubzilla-6ba32d714dd40c530aa40d1ae25dddb25a262a36.zip
save notes every ten seconds while focused, then save them once more on focusout
Diffstat (limited to 'view/tpl')
-rw-r--r--view/tpl/notes.tpl17
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>