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.
114 lines
4.5 KiB
114 lines
4.5 KiB
include ./report.pug
|
|
mixin post(post, truncate, manage=false, globalmanage=false, ban=false)
|
|
.anchor(id=post.postId)
|
|
div(class=`post-container ${post.thread || ban === true ? '' : 'op'}`)
|
|
- const postURL = `/${post.board}/thread/${post.thread || post.postId}.html`;
|
|
.post-info
|
|
label
|
|
if globalmanage
|
|
input.post-check(type='checkbox', name='globalcheckedposts' value=post._id)
|
|
else if !ban
|
|
input.post-check(type='checkbox', name='checkedposts' value=post.postId)
|
|
|
|
|
if !post.thread
|
|
include ../includes/postmods.pug
|
|
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.country && post.country.code
|
|
span(class=`flag flag-${post.country.code.toLowerCase()}` title=post.country.name alt=post.country.name)
|
|
|
|
|
if post.tripcode
|
|
span.post-tripcode #{post.tripcode}
|
|
|
|
|
if post.capcode
|
|
span.post-capcode #{post.capcode}
|
|
|
|
|
- const postDate = new Date(post.date)
|
|
time.post-date(datetime=postDate.toISOString()) #{postDate.toLocaleString("en-US", { hour12:false, timeZone: "America/New_York" })}
|
|
|
|
|
if post.userId
|
|
span.user-id(style=`background-color: #${post.userId}`) #{post.userId}
|
|
|
|
|
span.post-links
|
|
a.no-decoration(href=`${postURL}#${post.postId}`) No.
|
|
span.post-quoters
|
|
a.no-decoration(href=`${postURL}#postform`) #{post.postId}
|
|
if !post.thread
|
|
|
|
|
span: a(href=`${postURL}#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(data-type=file.mimetype.split('/')[0])
|
|
a(target='_blank' href=`/img/${file.filename}`)
|
|
if post.spoiler
|
|
img.file-thumb(src='/img/spoiler.png' width='200' height='200')
|
|
else if file.hasThumb
|
|
img.file-thumb(src=`/img/thumb-${file.hash}${file.thumbextension}` height=file.geometry.thumbheight width=file.geometry.thumbwidth)
|
|
else
|
|
img.file-thumb(src=`/img/${file.filename}` height=file.geometry.height width=file.geometry.width)
|
|
- let truncatedMessage = post.message;
|
|
if post.message
|
|
if truncate
|
|
-
|
|
const splitPost = post.message.split('\n');
|
|
const messageLines = splitPost.length;
|
|
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}
|
|
else
|
|
pre.post-message !{post.message}
|
|
if !post.message && post.files.length === 0
|
|
p Post files unlinked
|
|
if post.banmessage
|
|
p.banmessage USER WAS BANNED FOR THIS POST #{post.banmessage ? `(${post.banmessage})` : ''}
|
|
if truncatedMessage !== post.message
|
|
div.cb.mt-5.ml-5
|
|
| Message too long. #[a(href=`${postURL}#${post.postId}`) View the full text]
|
|
if post.omittedposts || post.omittedfiles
|
|
div.cb.mt-5.ml-5
|
|
- const ompo = post.omittedposts;
|
|
- const omfi = post.omittedfiles;
|
|
| #{ompo} repl#{ompo > 1 ? 'ies' : 'y'}
|
|
| #{omfi > 0 ? ` and ${omfi} image${omfi > 1 ? 's' : ''}` : ''} omitted.
|
|
| #[a(href=`${postURL}#${post.postId}`) View the full thread]
|
|
if post.previewbacklinks != null
|
|
if post.previewbacklinks.length > 0
|
|
div.replies.mt-5.ml-5 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
|
|
- const ombls = post.backlinks.length-post.previewbacklinks.length;
|
|
| + #[a(href=`${postURL}#${post.postId}`) #{ombls} earlier]
|
|
else if post.backlinks && post.backlinks.length > 0
|
|
div.replies.mt-5.ml-5 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 r in post.reports
|
|
+report(r)
|
|
if globalmanage === true
|
|
each r in post.globalreports
|
|
+report(r)
|
|
|