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
1 changed files with 13 additions and 26 deletions

View File

@ -2194,22 +2194,10 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
* @function * @function
* @param {object} comment * @param {object} comment
* @param {string} commentText * @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 === '') { if (commentText === '') {
commentText = 'comment decryption failed'; 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 // finally append comment
$place.append($commentEntry); $place.append($commentEntry);
} }
@ -2270,17 +2269,6 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
$discussion.removeClass('hidden'); $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 * removes the old discussion and prepares everything for creating a new
* one. * one.
@ -3703,7 +3691,6 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
} }
DiscussionViewer.finishDiscussion(); DiscussionViewer.finishDiscussion();
DiscussionViewer.showDiscussion();
return true; return true;
} }