aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/jot.tpl
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2018-04-04 15:22:38 -0400
committerAndrew Manning <tamanning@zoho.com>2018-04-04 15:22:38 -0400
commita5aff7d0c969adb78338e35a1d736ad80462b34b (patch)
tree152e15e52958adda27c16db513392f510493abd7 /view/tpl/jot.tpl
parentaca719ac741f86cb2ab97ca06bb10b93684e9abf (diff)
downloadvolse-hubzilla-a5aff7d0c969adb78338e35a1d736ad80462b34b.tar.gz
volse-hubzilla-a5aff7d0c969adb78338e35a1d736ad80462b34b.tar.bz2
volse-hubzilla-a5aff7d0c969adb78338e35a1d736ad80462b34b.zip
Post body and title are auto-saved
Diffstat (limited to 'view/tpl/jot.tpl')
-rwxr-xr-xview/tpl/jot.tpl32
1 files changed, 32 insertions, 0 deletions
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index bc9339d4c..90058ab30 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -40,6 +40,38 @@
<input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" data-role="cat-tagsinput">
</div>
{{/if}}
+
+ <script>
+
+ var postSaveTimer = null;
+
+ $(document).on('focusout',"#profile-jot-text",function(e){
+ if(postSaveTimer)
+ clearTimeout(postSaveTimer);
+ postSaveChanges(true);
+ postSaveTimer = null;
+ });
+
+ $(document).on('focusin',"#profile-jot-text",function(e){
+ postSaveTimer = setTimeout(function () {
+ postSaveChanges(false);
+ },10000);
+ });
+
+ function postSaveChanges(isFinal = false, type) {
+ $.post('autosavetext',
+ {
+ 'type' : 'post',
+ 'body' : $("#profile-jot-text").val(),
+ 'title': $("#jot-title").val()
+ }
+ );
+ if( !isFinal) {
+ postSaveTimer = setTimeout(postSaveChanges,10000);
+ }
+
+ }
+ </script>
<div id="jot-text-wrap">
<textarea class="profile-jot-text" id="profile-jot-text" name="body" tabindex="2" placeholder="{{$placeholdtext}}" >{{$content}}</textarea>
</div>