diff options
author | Andrew Manning <tamanning@zoho.com> | 2018-04-08 19:44:21 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2018-04-08 19:44:21 -0400 |
commit | f9ec3c66ff1305ca0647454d27793ac5365f7f4a (patch) | |
tree | 6978bc6679654a428b6192eeae856c0f9e2d0223 /view/js/main.js | |
parent | 4760dc9bcb7e43be9c27cf83ba5273344384813d (diff) | |
download | volse-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/js/main.js')
-rw-r--r-- | view/js/main.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/view/js/main.js b/view/js/main.js index d09615f3c..c3c2c850f 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -167,9 +167,13 @@ function handle_comment_form(e) { $('#' + commentElm).attr('tabindex','9'); $('#' + submitElm).attr('tabindex','10'); - var commentBody = localStorage.getItem("comment_body"); - if(commentBody && $('#' + commentElm).val() === '') { - $('#' + commentElm).val(commentBody); + if(auto_save_draft) { + var commentBody = localStorage.getItem("comment_body"); + if(commentBody && $('#' + commentElm).val() === '') { + $('#' + commentElm).val(commentBody); + } + } else { + localStorage.removeItem("comment_body"); } form.find(':not(:visible)').show(); @@ -207,10 +211,12 @@ function handle_comment_form(e) { },10000); }); - function commentSaveChanges(isFinal = false, type) { - localStorage.setItem("comment_body", $('#' + emptyCommentElm).val()); - if( !isFinal) { - commentSaveTimer = setTimeout(commentSaveChanges,10000); + function commentSaveChanges(isFinal = false) { + if(auto_save_draft) { + localStorage.setItem("comment_body", $('#' + emptyCommentElm).val()); + if( !isFinal) { + commentSaveTimer = setTimeout(commentSaveChanges,10000); + } } } } |