Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var closeOpenedCommentIfNotOnSelectedElements = function(e) {
// Don't do anything if clicked on the following elements:
if (shouldNotCloseComment(e) // any of the comment icons
|| commentBoxes.shouldNotCloseComment(e)) { // a comment box or the comment modal
return;
}
// All clear, can close the comment
var openedComment = findOpenedComment();
if (openedComment) {
toggleActiveCommentIcon($(openedComment));
var commentId = openedComment.getAttribute("data-commentid");
commentBoxes.hideComment(commentId, true);
}
}
}).on("click", ".comment-icon.inactive", function(e){
// deactivate/hide other comment boxes that are opened, so we have only
// one comment box opened at a time
commentBoxes.hideOpenedComments();
var allActiveIcons = getPadOuter().find('#commentIcons').find(".comment-icon.active");
toggleActiveCommentIcon(allActiveIcons);
// activate/show only target comment
toggleActiveCommentIcon($(this));
var commentId = targetCommentIdOf(e);
commentBoxes.showComment(commentId, e, true);
});
}
var closeOpenedCommentIfNotOnSelectedElements = function(e) {
// Don't do anything if clicked on the following elements:
if (shouldNotCloseComment(e) // any of the comment icons
|| commentBoxes.shouldNotCloseComment(e)) { // a comment box or the comment modal
return;
}
// All clear, can close the comment
var openedComment = findOpenedComment();
if (openedComment) {
toggleActiveCommentIcon($(openedComment));
var commentId = openedComment.getAttribute("data-commentid");
commentBoxes.hideComment(commentId, true);
}
}
}).on("click", ".comment-icon.inactive", function(e){
// deactivate/hide other comment boxes that are opened, so we have only
// one comment box opened at a time
commentBoxes.hideOpenedComments();
var allActiveIcons = getPadOuter().find('#commentIcons').find(".comment-icon.active");
toggleActiveCommentIcon(allActiveIcons);
// activate/show only target comment
toggleActiveCommentIcon($(this));
var commentId = targetCommentIdOf(e);
commentBoxes.showComment(commentId, e, true);
});
}
var localizeNewCommentForm = function() {
var newCommentForm = getNewCommentContainer().find('#newComment');
if (newCommentForm.length !== 0) commentL10n.localize(newCommentForm);
};