mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-25 16:49:26 +01:00
show stickied comments in posts
This commit is contained in:
parent
348e88fee4
commit
f27f27041e
3
dist/css/styles.css
vendored
3
dist/css/styles.css
vendored
@ -767,6 +767,9 @@ input[type="submit"]:hover,
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
#post .comment .meta p.stickied {
|
||||
color: green;
|
||||
}
|
||||
#post .comment .meta p.author a {
|
||||
font-weight: initial;
|
||||
margin-left: 10px;
|
||||
|
@ -6,27 +6,35 @@ module.exports = function() {
|
||||
if(comments.author !== undefined && comments.body_html !== undefined) {
|
||||
let classlist = []
|
||||
let submitter_link = ''
|
||||
let moderator = false
|
||||
let submitter = false
|
||||
|
||||
if(post_author === comments.author) {
|
||||
classlist.push('submitter')
|
||||
submitter_link = `<a href="${post_url}" title="submitter">[S]</a>`
|
||||
submitter = true
|
||||
}
|
||||
if(comments.author === 'AutoModerator') {
|
||||
if(comments.distinguished === 'moderator') {
|
||||
classlist.push('green')
|
||||
moderator_badge = ` <span class="green" title="moderator of this subreddit">[M]</span>`
|
||||
moderator = true
|
||||
}
|
||||
comments_html = `
|
||||
<div class="comment" id="${comments.id}">
|
||||
<details open>
|
||||
<summary>
|
||||
<a href="/u/${comments.author}">${comments.author}</a>
|
||||
<a href="/u/${comments.author}">${comments.author}${moderator ? moderator_badge : ''}</a>
|
||||
<p class="ups">${kFormatter(comments.ups)} points</p>
|
||||
<p class="created" title="${toUTCString(comments.created)}">${timeDifference(comments.created)}</p>
|
||||
<p class="stickied">${comments.stickied ? 'stickied comment' : ''}</p>
|
||||
</summary>
|
||||
<div class="meta">
|
||||
<p class="author"><a href="/u/${comments.author}" class="${classlist.join(' ')}">${comments.author}</a>${comments.author === post_author ? submitter_link : ''}</p>
|
||||
<p class="author"><a href="/u/${comments.author}" class="${classlist.join(' ')}">${comments.author}</a>${submitter ? submitter_link : ''}${moderator ? moderator_badge : ''}</p>
|
||||
<p class="ups">${kFormatter(comments.ups)} points</p>
|
||||
<p class="created" title="${toUTCString(comments.created)}">
|
||||
<a href="${comments.permalink}">${timeDifference(comments.created)}</a>
|
||||
</p>
|
||||
</p>
|
||||
<p class="stickied">${comments.stickied ? 'stickied comment' : ''}</p>
|
||||
</div>
|
||||
<div class="body">${unescape(comments.body_html)}</div>
|
||||
`
|
||||
@ -74,28 +82,35 @@ module.exports = function() {
|
||||
if(comment.type !== 'load_more') {
|
||||
let classlist = []
|
||||
let submitter_link = ''
|
||||
let moderator = false
|
||||
let submitter = false
|
||||
|
||||
if(post_author === comment.author) {
|
||||
classlist.push('submitter')
|
||||
submitter_link = `<a href="${post_url}" title="submitter">[S]</a>`
|
||||
submitter = true
|
||||
}
|
||||
if(comment.author === 'AutoModerator') {
|
||||
if(comments.distinguished === 'moderator') {
|
||||
classlist.push('green')
|
||||
moderator_badge = ` <span class="green" title="moderator of this subreddit">[M]</span>`
|
||||
moderator = true
|
||||
}
|
||||
comments_html += `
|
||||
<div class="comment" id="${comment.id}">
|
||||
<details open>
|
||||
<summary>
|
||||
<a href="/u/${comment.author}">${comment.author}</a>
|
||||
<a href="/u/${comment.author}">${comment.author}${moderator ? moderator_badge : ''}</a>
|
||||
<p class="ups">${kFormatter(comment.ups)} points</p>
|
||||
<p class="created" title="${toUTCString(comment.created)}">${timeDifference(comment.created)}</p>
|
||||
<p class="stickied">${comment.stickied ? 'stickied comment' : ''}</p>
|
||||
</summary>
|
||||
<div class="meta">
|
||||
<p class="author"><a href="/u/${comment.author}" class="${classlist.join(' ')}">${comment.author}</a>${comment.author === post_author ? submitter_link : ''}</p>
|
||||
<p class="author"><a href="/u/${comment.author}" class="${classlist.join(' ')}">${comment.author}</a>${submitter ? submitter_link : ''}${moderator ? moderator_badge : ''}</p>
|
||||
<p class="ups">${kFormatter(comment.ups)} points</p>
|
||||
<p class="created" title="${toUTCString(comment.created)}">
|
||||
<a href="${comment.permalink}">${timeDifference(comment.created)}</a>
|
||||
</p>
|
||||
<p class="stickied">${comment.stickied ? 'stickied comment' : ''}</p>
|
||||
</div>
|
||||
<div class="body">${unescape(comment.body_html)}</div>
|
||||
`
|
||||
|
@ -136,6 +136,8 @@ module.exports = function(fetch) {
|
||||
ups: comment.ups,
|
||||
id: comment.id,
|
||||
permalink: comment.permalink,
|
||||
stickied: comment.stickied,
|
||||
distinguished: comment.distinguished,
|
||||
replies: []
|
||||
}
|
||||
} else {
|
||||
@ -208,6 +210,8 @@ module.exports = function(fetch) {
|
||||
ups: reply.ups,
|
||||
id: reply.id,
|
||||
permalink: reply.permalink,
|
||||
stickied: reply.stickied,
|
||||
distinguished: reply.distinguished,
|
||||
replies: []
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user