From 65833ed34a414c64b316bfa04275c9c7e183644b Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Thu, 20 Aug 2015 17:31:16 +0500 Subject: [PATCH] change way of post preview hiding; focus on textarea if it has some when switching --- js/interface_common.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index fb26ef2..a3d1e93 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -410,6 +410,10 @@ function reTwistPopup(event, post, textArea) { }); } else { replyArea.find('textarea').replaceWith(textArea); + if (textArea.val()) { + textArea.focus(); + replyArea.addClass('open'); + } } replyArea.find('.post-submit').addClass('with-reference'); } @@ -619,18 +623,18 @@ function posPostPreview(event) { postPreview.width(textArea.width()); postPreview.width(postPreview.width() // width is not accurate if we do it with textArea.width() directly, don't know why - postPreview.css('padding-left') - postPreview.css('padding-right')); - textArea.on('focusout', function () {$(this).siblings('#post-preview').hide();}); } if (textArea[0].value.length) postPreview.html(htmlFormatMsg(textArea[0].value).html).show(); else - postPreview.hide(); + postPreview.slideUp('fast'); textArea.before(postPreview); } // Reduz Área do Novo post function unfocusThis() { - $(this).removeClass('open'); + $(this).removeClass('open') + .find('#post-preview').slideUp('fast'); } function checkPostForMentions(post, mentions, max) { @@ -735,7 +739,7 @@ function replyTextInput(event) { if (textArea[0].value.length) textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value).html).show(); else - textAreaForm.find('#post-preview').html('').hide(); + textAreaForm.find('#post-preview').html('').slideUp('fast'); } } @@ -1255,7 +1259,7 @@ function postSubmit(e, oldLastPostId) { var textArea = btnPostSubmit.closest('.post-area-new').find('textarea'); - textArea.siblings('#post-preview').hide(); + textArea.siblings('#post-preview').slideUp('fast'); var postData = btnPostSubmit.closest('.post-data'); if (!postData.length) {