diff --git a/dist/css/styles.css b/dist/css/styles.css index 9859100..55d5ebb 100644 --- a/dist/css/styles.css +++ b/dist/css/styles.css @@ -573,6 +573,11 @@ input[type="submit"]:hover, padding-left: 3px; padding-right: 3px; } +#links .link .entry .meta .deleted { + margin-left: 0 !important; + padding-left: 5px; + padding-right: 3px; +} #links .link .entry .meta p { float: inherit; overflow-wrap: anywhere; @@ -805,7 +810,8 @@ input[type="submit"]:hover, font-size: small; color: #686868; } -#post .submitted a { +#post .submitted a, +#post .submitted span { margin-left: 5px; } #post .comments { @@ -815,7 +821,8 @@ input[type="submit"]:hover, #post .comment .meta p.stickied { color: green; } -#post .comment .meta p.author a { +#post .comment .meta p.author a, +#post .comment .meta p.author span { font-weight: initial; margin-left: 10px; } diff --git a/inc/compilePostComments.js b/inc/compilePostComments.js index 829ed0c..8afcf66 100644 --- a/inc/compilePostComments.js +++ b/inc/compilePostComments.js @@ -3,6 +3,15 @@ module.exports = function() { return new Promise((resolve, reject) => { (async () => { let comments_html + + function commentAuthor(comment, classlist, submitter, moderator) { + let classes = classlist.join(' ') + if (comment.author === '[deleted]') + return `[deleted]` + else + return `${comment.author}${submitter || ''}${moderator || ''}` + } + if(comments.author !== undefined && comments.body_html !== undefined) { let classlist = [] let submitter_link = '' @@ -32,13 +41,13 @@ module.exports = function() {
- ${comments.author}${moderator ? moderator_badge : ''} +
${commentAuthor(comments, classlist, submitter && submitter_link, moderator && moderator_badge)}
${ups}
${timeDifference(comments.created)}${edited_span}
${comments.stickied ? 'stickied comment' : ''}
${comments.author}${submitter ? submitter_link : ''}${moderator ? moderator_badge : ''}
+${commentAuthor(comments, classlist, submitter && submitter_link, moderator && moderator_badge)}
${ups}
${timeDifference(comments.created)}${edited_span} @@ -118,13 +127,13 @@ module.exports = function() {
- ${comment.author}${moderator ? moderator_badge : ''} +
${commentAuthor(comment, classlist, submitter && submitter_link, moderator && moderator_badge)}
${ups}
${timeDifference(comment.created)}${edited_span}
${comment.stickied ? 'stickied comment' : ''}
${comment.author}${submitter ? submitter_link : ''}${moderator ? moderator_badge : ''}
+${commentAuthor(comment, classlist, submitter && submitter_link, moderator && moderator_badge)}
${ups}
${timeDifference(comment.created)}${edited_span} diff --git a/views/index.pug b/views/index.pug index bed1f47..e6244f6 100644 --- a/views/index.pug +++ b/views/index.pug @@ -88,8 +88,11 @@ html .meta p.submitted submitted span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by - a(href="/u/" + link.author + "") - | #{link.author} + if link.author === '[deleted]' + span(class="deleted") [deleted] + else + a(href="/u/" + link.author + "") + | #{link.author} span(class="to") to a(href="/r/" + link.subreddit + "") | #{link.subreddit} diff --git a/views/post.pug b/views/post.pug index 8e76b2a..9ad4b17 100644 --- a/views/post.pug +++ b/views/post.pug @@ -28,8 +28,11 @@ html span(class="domain") (#{post.domain}) p.submitted span(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by - a(href="/u/" + post.author + "") - | #{post.author} + if post.author === '[deleted]' + span [deleted] + else + a(href="/u/" + post.author + "") + | #{post.author} if post.crosspost.is_crosspost === true .crosspost .title @@ -44,8 +47,11 @@ html div.arrow.down p.submitted span(title="" + toUTCString(post.crosspost.created) + "") submitted #{timeDifference(post.crosspost.created)} by - a(href="/u/" + post.crosspost.author + "") - | #{post.crosspost.author} + if post.crosspost.author === '[deleted]' + span [deleted] + else + a(href="/u/" + post.crosspost.author + "") + | #{post.crosspost.author} p.to to a(href="/r/" + post.crosspost.subreddit + "") | #{post.crosspost.subreddit} @@ -129,3 +135,4 @@ html p you are viewing a single comment's thread. a(href="" + post_url + "") view the rest of the comments → != comments + diff --git a/views/search.pug b/views/search.pug index 7e17736..9bcd3f1 100644 --- a/views/search.pug +++ b/views/search.pug @@ -108,7 +108,12 @@ html a(href="" + post.permalink + "") #{cleanTitle(post.title)} .meta p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by - a(href="/u/" + post.author + "") #{post.author} + //- I believe finding posts by deleted authors is impossible + if post.author === '[deleted]' + span [deleted] + else + a(href="/u/" + post.author + "") + | #{post.author} | to a(href="/r/" + post.subreddit + "", class="subreddit") r/#{post.subreddit} a.comments(href="" + post.permalink + "") #{post.num_comments} comments diff --git a/views/subreddit.pug b/views/subreddit.pug index a5951e9..31fa078 100644 --- a/views/subreddit.pug +++ b/views/subreddit.pug @@ -96,8 +96,11 @@ html .meta p.submitted submitted span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by - a(href="/u/" + link.author + "") - | #{link.author} + if link.author === '[deleted]' + span(class="deleted") [deleted] + else + a(href="/u/" + link.author + "") + | #{link.author} p.to to a(href="/r/" + link.subreddit + "") | #{link.subreddit} @@ -146,3 +149,4 @@ html each subreddit in subreddits li a(href="/r/" + subreddit + "") #{subreddit} + diff --git a/views/user.pug b/views/user.pug index b751052..8344c37 100644 --- a/views/user.pug +++ b/views/user.pug @@ -92,10 +92,10 @@ html a(href="" + post.url + "") #{cleanTitle(post.link_title)} .author p by - if post.link_author !== '[deleted]' - a(href="/u/" + post.link_author + "") #{post.link_author} - else + if post.link_author === '[deleted]' | [deleted] + else + a(href="/u/" + post.link_author + "") #{post.link_author} .subreddit p in a(href="/r/" + post.subreddit + "") #{post.subreddit}