removing duplicate code and unused option

This commit is contained in:
El RIDO 2018-01-02 11:42:03 +01:00
parent 49feb300b6
commit 28f1f41c17
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92

View File

@ -2194,22 +2194,10 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
* @function
* @param {object} comment
* @param {string} commentText
* @param {jQuery} $place - optional, tries to find the best position otherwise
* @param {string} nickname
*/
me.addComment = function(comment, commentText, nickname, $place)
me.addComment = function(comment, commentText, nickname)
{
if (typeof $place === 'undefined') {
// starting point (default value/fallback)
$place = $commentContainer;
// if parent comment exists
var $parentComment = $('#comment_' + comment.parentid);
if ($parentComment.length) {
// use parent as position for noew comment, so it shifted
// to the right
$place = $parentComment;
}
}
if (commentText === '') {
commentText = 'comment decryption failed';
}
@ -2251,6 +2239,17 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
});
}
// starting point (default value/fallback)
var $place = $commentContainer;
// if parent comment exists
var $parentComment = $('#comment_' + comment.parentid);
if ($parentComment.length) {
// use parent as position for new comment, so it is shifted
// to the right
$place = $parentComment;
}
// finally append comment
$place.append($commentEntry);
}
@ -2270,17 +2269,6 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
$discussion.removeClass('hidden');
}
/**
* shows the discussion area
*
* @name DiscussionViewer.showDiscussion
* @function
*/
me.showDiscussion = function()
{
$discussion.removeClass('hidden');
}
/**
* removes the old discussion and prepares everything for creating a new
* one.
@ -3703,7 +3691,6 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
}
DiscussionViewer.finishDiscussion();
DiscussionViewer.showDiscussion();
return true;
}