From b8a819cfa4e20384e5b9838f7c8518fefcb28fb3 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 22 Nov 2020 20:08:20 +0100 Subject: [PATCH] add * for comments which are edited, like in reddit --- inc/compilePostComments.js | 16 ++++++++++++---- inc/processJsonPost.js | 3 +++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/inc/compilePostComments.js b/inc/compilePostComments.js index 930613e..829ed0c 100644 --- a/inc/compilePostComments.js +++ b/inc/compilePostComments.js @@ -8,6 +8,7 @@ module.exports = function() { let submitter_link = '' let moderator = false let submitter = false + let edited_span = '' if(post_author === comments.author) { classlist.push('submitter') @@ -24,20 +25,23 @@ module.exports = function() { } else { ups = `${kFormatter(comments.ups)} points` } + if(comments.edited) { + edited_span = `*` + } comments_html = `
${comments.author}${moderator ? moderator_badge : ''}

${ups}

-

${timeDifference(comments.created)}

+

${timeDifference(comments.created)}${edited_span}

${comments.stickied ? 'stickied comment' : ''}

${comments.author}${submitter ? submitter_link : ''}${moderator ? moderator_badge : ''}

${ups}

- ${timeDifference(comments.created)} + ${timeDifference(comments.created)}${edited_span}

${comments.stickied ? 'stickied comment' : ''}

@@ -90,6 +94,7 @@ module.exports = function() { let moderator = false let submitter = false let ups = '' + let edited_span = '' if(post_author === comment.author) { classlist.push('submitter') @@ -106,20 +111,23 @@ module.exports = function() { } else { ups = `${kFormatter(comment.ups)} points` } + if(comment.edited) { + edited_span = `*` + } comments_html += `
${comment.author}${moderator ? moderator_badge : ''}

${ups}

-

${timeDifference(comment.created)}

+

${timeDifference(comment.created)}${edited_span}

${comment.stickied ? 'stickied comment' : ''}

${comment.author}${submitter ? submitter_link : ''}${moderator ? moderator_badge : ''}

${ups}

- ${timeDifference(comment.created)} + ${timeDifference(comment.created)}${edited_span}

${comment.stickied ? 'stickied comment' : ''}

diff --git a/inc/processJsonPost.js b/inc/processJsonPost.js index f03f387..3021bc0 100644 --- a/inc/processJsonPost.js +++ b/inc/processJsonPost.js @@ -139,6 +139,7 @@ module.exports = function(fetch) { stickied: comment.stickied, distinguished: comment.distinguished, score_hidden: comment.score_hidden, + edited: comment.edited, replies: [] } } else { @@ -214,6 +215,7 @@ module.exports = function(fetch) { stickied: reply.stickied, distinguished: reply.distinguished, score_hidden: reply.score_hidden, + edited: reply.edited, replies: [] } } else { @@ -247,6 +249,7 @@ module.exports = function(fetch) { permalink: comment.permalink, score_hidden: comment.score_hidden, distinguished: comment.distinguished, + distinguished: comment.edited, replies: [] } } else {