diff --git a/js/card.js b/js/card.js index 6ced81c..72a3833 100644 --- a/js/card.js +++ b/js/card.js @@ -149,7 +149,7 @@ export const card = (() => {

${moreThanMaxLength ? (original.slice(0, maxCommentLength) + '...') : original}

- ${moreThanMaxLength ? `

Selengkapnya

` : ''}`; + ${moreThanMaxLength ? `

Selengkapnya

` : ''}`; }; const renderContent = (comment, is_parent) => { diff --git a/js/comment.js b/js/comment.js index d18583d..2cae54b 100644 --- a/js/comment.js +++ b/js/comment.js @@ -118,9 +118,18 @@ export const comment = (() => { const original = card.convertMarkdownToHTML(util.escapeHtml(form.value)); const content = document.getElementById(`content-${id}`); - content.innerHTML = show && show.getAttribute('data-show') == 'false' ? original.slice(0, card.maxCommentLength) + '...' : original; if (original.length > card.maxCommentLength) { + content.innerHTML = show?.getAttribute('data-show') === 'false' ? original.slice(0, card.maxCommentLength) + '...' : original; content.setAttribute('data-comment', util.base64Encode(original)); + if (show?.style.display === 'none') { + show.style.display = 'block'; + } + } else { + content.innerHTML = original; + content.removeAttribute('data-comment'); + if (show?.style.display === 'block') { + show.style.display = 'none'; + } } if (presence) {