aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js/main.js')
-rw-r--r--view/js/main.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 66a1452e3..c1e7bd4ec 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -190,7 +190,7 @@ function handle_comment_form(e) {
var commentSaveTimer = null;
var emptyCommentElm = form.find('.comment-edit-text').attr('id');
- var convId = emptyCommentElm.replace(/comment-edit-text-/,'');
+ var convId = emptyCommentElm.replace('comment-edit-text-','');
$(document).on('focusout','#' + emptyCommentElm,function(e){
if(commentSaveTimer)
clearTimeout(commentSaveTimer);
@@ -206,7 +206,13 @@ function handle_comment_form(e) {
function commentSaveChanges(convId,isFinal = false) {
if(auto_save_draft) {
- localStorage.setItem("comment_body" + convId, $('#' + emptyCommentElm).val());
+ tmp = $('#' + emptyCommentElm).val();
+ if(tmp) {
+ localStorage.setItem("comment_body-" + convId, tmp);
+ }
+ else {
+ localStorage.removeItem("comment_body-" + convId);
+ }
if( !isFinal) {
commentSaveTimer = setTimeout(commentSaveChanges,10000,convId);
}
@@ -596,8 +602,6 @@ function updateConvItems(mode,data) {
var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
-
-
var itmId = 0;
var isVisible = false;
@@ -632,17 +636,19 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
- var commentBody = localStorage.getItem("comment_body" + convId);
+ var commentBody = localStorage.getItem("comment_body-" + convId);
if(commentBody) {
- var commentElm = $('#comment-edit-text' + convId);
+ var commentElm = $('#comment-edit-text-' + convId);
if(auto_save_draft) {
- if(commentBody && $('#' + commentElm).val() === '') {
+ if($(commentElm).val() === '') {
$('#comment-edit-form-' + convId).show();
- $('#' + commentElm).val(commentBody);
+ $(commentElm).addClass("expanded");
+ openMenu("comment-tools-" + convId);
+ $(commentElm).val(commentBody);
}
} else {
- localStorage.removeItem("comment_body" + convId);
+ localStorage.removeItem("comment_body-" + convId);
}
}