in ArticleTemplates/assets/js/modules/comments.js [51:80]
function commentsReplyFormatting() {
const threads = document.getElementsByClassName('block--discussion-thread');
let thread;
let moreButton;
let numOfComments;
let i;
for (i = 0; i < threads.length; i++) {
thread = threads[i];
if (!thread.classList.contains('block--discussion-thread--checked') &&
thread.children &&
thread.children.length >= 5) {
numOfComments = thread.children.length - 4;
if (numOfComments === 1) {
thread.classList.add('block--discussion-thread--orphan');
} else {
moreButton = document.createElement('div');
moreButton.classList.add('more');
moreButton.classList.add('more--comments');
moreButton.innerHTML = `<a class="more__label"><span class="more__icon" data-icon="" aria-hidden="true"></span><span class="more__text">${numOfComments} more replies</span></a>`;
moreButton.addEventListener('click', handleMoreCommentsClick.bind(null, moreButton));
thread.children[4].parentNode.insertBefore(moreButton, thread.children[4]);
}
}
thread.classList.add('block--discussion-thread--checked');
}
}