From 28f1f41c176540583e3deff3aa770b93057e6785 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Tue, 2 Jan 2018 11:42:03 +0100 Subject: [PATCH] removing duplicate code and unused option --- js/privatebin.js | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 0de6806e..ec8aaa01 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -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; }