mirror of https://gitgud.io/fatchan/jschan.git
parent
65db7a1495
commit
1ead7e26c3
5 changed files with 124 additions and 110 deletions
@ -1,103 +1,104 @@ |
|||||||
mixin post(post, truncate, manage=false, globalmanage=false) |
mixin post(post, truncate, manage=false, globalmanage=false) |
||||||
article(id=post.postId class='post-container '+(post.thread ? '' : 'op')) |
.pad-anchor(id=post.postId) |
||||||
- const postURL = `/${post.board}/thread/${post.thread || post.postId}.html#${post.postId}`; |
article(class='post-container '+(post.thread ? '' : 'op')) |
||||||
header.post-info |
- const postURL = `/${post.board}/thread/${post.thread || post.postId}.html#${post.postId}`; |
||||||
if globalmanage |
header.post-info |
||||||
input.post-check(type='checkbox', name='globalcheckedposts[]' value=post._id) |
if globalmanage |
||||||
else |
input.post-check(type='checkbox', name='globalcheckedposts[]' value=post._id) |
||||||
input.post-check(type='checkbox', name='checkedposts[]' value=post.postId) |
|
||||||
| |
|
||||||
if !post.thread |
|
||||||
if post.sticky |
|
||||||
img(src='/img/sticky.svg' height='12' title='Stickied') |
|
||||||
| |
|
||||||
if post.saged |
|
||||||
img(src='/img/saged.svg' height='12' title='Permasaged') |
|
||||||
| |
|
||||||
if post.locked |
|
||||||
img(src='/img/locked.svg' height='12' title='Locked') |
|
||||||
| |
|
||||||
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) No.#{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 Message too long. #[a(href=postURL) View the full text] |
|
||||||
else |
else |
||||||
pre.post-message !{post.message} |
input.post-check(type='checkbox', name='checkedposts[]' value=post.postId) |
||||||
if post.banmessage |
| |
||||||
blockquote.banmessage USER WAS BANNED FOR THIS POST (#{post.banmessage}) |
if !post.thread |
||||||
if post.omittedposts || post.omittedimages |
if post.sticky |
||||||
blockquote #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=postURL) View the full thread] |
img(src='/img/sticky.svg' height='12' title='Stickied') |
||||||
if post.backlinks && post.backlinks.length > 0 |
| |
||||||
.replies Replies: |
if post.saged |
||||||
each backlink in post.backlinks |
img(src='/img/saged.svg' height='12' title='Permasaged') |
||||||
a.quote(href=`/${post.board}/thread/${post.thread || post.postId}.html#${backlink}`) >>#{backlink} |
|
||||||
| |
| |
||||||
if manage === true |
if post.locked |
||||||
each report in post.reports |
img(src='/img/locked.svg' height='12' title='Locked') |
||||||
.reports.post-container |
| |
||||||
span Date: #{report.date.toLocaleString()} |
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} |
||||||
| |
| |
||||||
span Reason: #{report.reason} |
if post.tripcode |
||||||
if globalmanage === true |
span.post-tripcode #{post.tripcode} |
||||||
each report in post.globalreports |
| |
||||||
.reports.post-container |
if post.capcode |
||||||
span Date: #{report.date.toLocaleString()} |
span.post-capcode #{post.capcode} |
||||||
|
| |
||||||
|
span #{post.date.toLocaleString()} |
||||||
| |
| |
||||||
span Reason: #{report.reason} |
if post.userId |
||||||
|
span.user-id(style=`background: #${post.userId}`) #{post.userId} |
||||||
|
| |
||||||
|
span: a(href=postURL) No.#{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 Message too long. #[a(href=postURL) View the full text] |
||||||
|
else |
||||||
|
pre.post-message !{post.message} |
||||||
|
if post.banmessage |
||||||
|
blockquote.banmessage USER WAS BANNED FOR THIS POST (#{post.banmessage}) |
||||||
|
if post.omittedposts || post.omittedimages |
||||||
|
blockquote #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=postURL) View the full thread] |
||||||
|
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}`) >>#{backlink} |
||||||
|
| |
||||||
|
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} |
||||||
|
Loading…
Reference in new issue