mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.4 KiB
118 lines
4.4 KiB
mixin post(post, truncate, manage=false, globalmanage=false)
|
|
.anchor(id=post.postId)
|
|
article(class=`post-container ${post.thread ? '' : 'op'}`)
|
|
- const postURL = `/${post.board}/thread/${post.thread || post.postId}.html`;
|
|
header.post-info
|
|
label
|
|
if globalmanage
|
|
input.post-check(type='checkbox', name='globalcheckedposts[]' value=post._id)
|
|
else
|
|
input.post-check(type='checkbox', name='checkedposts[]' value=post.postId)
|
|
|
|
|
if !post.thread
|
|
if post.sticky
|
|
img(src='/img/sticky.svg' height='12' title='Sticky')
|
|
|
|
|
if post.saged
|
|
img(src='/img/saged.svg' height='12' title='Bumplocked')
|
|
|
|
|
if post.locked
|
|
img(src='/img/locked.svg' height='12' title='Locked')
|
|
|
|
|
if post.cyclic
|
|
img(src='/img/cyclic.svg' height='13' title='Cyclic')
|
|
|
|
|
if post.subject
|
|
span.post-subject #{post.subject}
|
|
|
|
|
if post.email
|
|
a(href=`mailto:${post.email}`)
|
|
span.post-name #{post.name}
|
|
else
|
|
span.post-name #{post.name}
|
|
|
|
|
if post.tripcode
|
|
span.post-tripcode #{post.tripcode}
|
|
|
|
|
if post.capcode
|
|
span.post-capcode #{post.capcode}
|
|
|
|
|
span #{post.date.toLocaleString()}
|
|
|
|
|
if post.userId
|
|
span.user-id(style=`background: #${post.userId}`) #{post.userId}
|
|
|
|
|
span: a(href=`${postURL}#${post.postId}`) No.
|
|
span: a(href=`${postURL}#postform`) #{post.postId}
|
|
if !post.thread
|
|
|
|
|
span: a(href=`/${post.board}/thread/${post.thread || post.postId}.html#postform`) [Reply]
|
|
.post-data
|
|
if post.files.length > 0
|
|
.post-files
|
|
each file in post.files
|
|
.post-file
|
|
span.post-file-info
|
|
span: a(href='/img/'+file.filename title='Download '+file.originalFilename download=file.originalFilename) #{post.spoiler ? 'Spoiler File' : file.originalFilename}
|
|
br
|
|
span
|
|
| (#{file.sizeString}, #{file.geometryString}
|
|
if file.durationString
|
|
| , #{file.durationString}
|
|
| )
|
|
.post-file-src
|
|
a(target='_blank' href=`/img/${file.filename}`)
|
|
if post.spoiler
|
|
img.file-thumb(src='/img/spoiler.png' width='128' height='128')
|
|
else if file.hasThumb
|
|
object.file-thumb(data=`/img/thumb-${file.filename.split('.')[0]}.jpg`)
|
|
img(src='/img/deleted.png')
|
|
else
|
|
object.file-thumb(data=`/img/${file.filename}`)
|
|
img(src='/img/deleted.png')
|
|
if post.message
|
|
if truncate
|
|
-
|
|
const splitPost = post.message.split('\n');
|
|
const messageLines = splitPost.length;
|
|
let truncatedMessage = post.message;
|
|
if (messageLines > 10) {
|
|
truncatedMessage = splitPost.slice(0, 10).join('\n');
|
|
} else if (post.message.length > 1000) {
|
|
truncatedMessage = post.message.substring(0,1000).replace(/<([\w]+)?([^>]*)?$/, '');
|
|
}
|
|
pre.post-message !{truncatedMessage}
|
|
if truncatedMessage !== post.message
|
|
blockquote.muted Message too long. #[a(href=`${postURL}#${post.postId}`) View the full text]
|
|
else
|
|
pre.post-message !{post.message}
|
|
if !post.message && post.files.length === 0
|
|
blockquote.muted Post file(s) unlinked
|
|
if post.banmessage
|
|
blockquote.banmessage USER BANNED FOR THIS POST (#{post.banmessage || 'No reason specified'})
|
|
if post.omittedposts || post.omittedimages
|
|
blockquote.muted #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=`${postURL}#${post.postId}`) View the full thread]
|
|
if post.previewbacklinks
|
|
.replies Replies:
|
|
each backlink in post.previewbacklinks
|
|
a.quote(href=`/${post.board}/thread/${post.thread || post.postId}.html#${backlink.postId}`) >>#{backlink.postId}
|
|
|
|
|
if post.previewbacklinks.length < post.backlinks.length
|
|
| + #{post.backlinks.length-post.previewbacklinks.length} reply link(s) omitted
|
|
else if post.backlinks && post.backlinks.length > 0
|
|
.replies Replies:
|
|
each backlink in post.backlinks
|
|
a.quote(href=`/${post.board}/thread/${post.thread || post.postId}.html#${backlink.postId}`) >>#{backlink.postId}
|
|
|
|
|
if manage === true
|
|
each report in post.reports
|
|
.reports.post-container
|
|
span Date: #{report.date.toLocaleString()}
|
|
|
|
|
span Reason: #{report.reason}
|
|
if globalmanage === true
|
|
each report in post.globalreports
|
|
.reports.post-container
|
|
span Date: #{report.date.toLocaleString()}
|
|
|
|
|
span Reason: #{report.reason}
|
|
|