aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/jot-header.tpl
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2018-04-08 19:44:21 -0400
committerAndrew Manning <tamanning@zoho.com>2018-04-08 19:44:21 -0400
commitf9ec3c66ff1305ca0647454d27793ac5365f7f4a (patch)
tree6978bc6679654a428b6192eeae856c0f9e2d0223 /view/tpl/jot-header.tpl
parent4760dc9bcb7e43be9c27cf83ba5273344384813d (diff)
downloadvolse-hubzilla-f9ec3c66ff1305ca0647454d27793ac5365f7f4a.tar.gz
volse-hubzilla-f9ec3c66ff1305ca0647454d27793ac5365f7f4a.tar.bz2
volse-hubzilla-f9ec3c66ff1305ca0647454d27793ac5365f7f4a.zip
Added feature setting for auto-save, defaulting to enabled.
Diffstat (limited to 'view/tpl/jot-header.tpl')
-rwxr-xr-xview/tpl/jot-header.tpl62
1 files changed, 35 insertions, 27 deletions
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 2b4284ade..7af344681 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -580,37 +580,45 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
});
function postSaveChanges(isFinal = false, type) {
- localStorage.setItem("post_title", $("#jot-title").val());
- localStorage.setItem("post_body", $("#profile-jot-text").val());
- localStorage.setItem("post_category", $("#jot-category").val());
- if( !isFinal) {
- postSaveTimer = setTimeout(postSaveChanges,10000);
- }
+ if({{$auto_save_draft}}) {
+ localStorage.setItem("post_title", $("#jot-title").val());
+ localStorage.setItem("post_body", $("#profile-jot-text").val());
+ localStorage.setItem("post_category", $("#jot-category").val());
+ if( !isFinal) {
+ postSaveTimer = setTimeout(postSaveChanges,10000);
+ }
+ }
}
$(document).ready(function() {
- var postTitle = localStorage.getItem("post_title");
- var postBody = localStorage.getItem("post_body");
- var postCategory = localStorage.getItem("post_category");
- var openEditor = false;
- if(postTitle) {
- $('#jot-title').val(postTitle);
- openEditor = true;
- }
- if(postBody) {
- $('#profile-jot-text').val(postBody);
- openEditor = true;
- }
- if(postCategory) {
- var categories = postCategory.split(',');
- categories.forEach(function(cat) {
- $('#jot-category').tagsinput('add', cat);
- });
- openEditor = true;
- }
- if(openEditor) {
- initEditor();
+ if({{$auto_save_draft}}) {
+ var postTitle = localStorage.getItem("post_title");
+ var postBody = localStorage.getItem("post_body");
+ var postCategory = localStorage.getItem("post_category");
+ var openEditor = false;
+ if(postTitle) {
+ $('#jot-title').val(postTitle);
+ openEditor = true;
+ }
+ if(postBody) {
+ $('#profile-jot-text').val(postBody);
+ openEditor = true;
+ }
+ if(postCategory) {
+ var categories = postCategory.split(',');
+ categories.forEach(function(cat) {
+ $('#jot-category').tagsinput('add', cat);
+ });
+ openEditor = true;
+ }
+ if(openEditor) {
+ initEditor();
+ }
+ } else {
+ localStorage.removeItem("post_title");
+ localStorage.removeItem("post_body");
+ localStorage.removeItem("post_category");
}
});