teddit/views/user.pug

154 lines
7.3 KiB
Plaintext
Raw Normal View History

2020-11-17 21:44:32 +01:00
doctype html
html
head
title overview for #{data.username}
include includes/head.pug
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
2020-11-17 21:44:32 +01:00
include includes/topbar.pug
if user === null
h1 Error occured
p #{JSON.stringify(error_data)}
else
#user
2021-01-29 19:41:32 +01:00
header
.bottom
a(href="/u/" + data.username + "")
h3.username user: #{data.username}
ul.tabmenu
li(class=!data.post_type || data.post_type == '' ? 'active' : '')
a(href="/u/" + data.username) overview
li(class=data.post_type === '/comments' ? 'active' : '')
a(href="/u/" + data.username + "/comments") comments
li(class=data.post_type === '/submitted' ? 'active' : '')
a(href="/u/" + data.username + "/submitted") submitted
2020-11-17 21:44:32 +01:00
#links
details
summary
if !sortby || sortby === 'new'
span sorted by: new
if sortby === 'hot'
span sorted by: hot
if sortby === 'top'
span sorted by: top
if sortby === 'controversial'
span sorted by: controversial
ul
li(class=!sortby || sortby == 'new' ? 'active' : '')
a(href="/u/" + data.username + data.post_type) new
2020-11-17 21:44:32 +01:00
li(class=sortby === 'hot' ? 'active' : '')
a(href="/u/" + data.username + data.post_type + "?sort=hot") hot
2020-11-17 21:44:32 +01:00
li(class=sortby === 'top' ? 'active' : '')
a(href="/u/" + data.username + data.post_type + "?sort=top&t=" + past + "") top
2020-11-17 21:44:32 +01:00
li(class=sortby === 'controversial' ? 'active' : '')
a(href="/u/" + data.username + data.post_type + "?sort=controversial&t=" + past + "") controversial
2020-11-17 21:44:32 +01:00
if sortby === 'top' || sortby === 'controversial'
details
summary
if past === 'all'
span links and comments from: all time
if past === 'hour'
span links and comments from: past hour
if past === 'day'
span links and comments from: past 24 hours
if past === 'week'
span links and comments from: past week
if past === 'month'
span links and comments from: past month
if past === 'year'
span links and comments from: past year
ul
li(class=past === 'hour' ? 'active' : '')
a(href="?sort=" + sortby + "&t=hour") past hour
li(class=past === 'day' ? 'active' : '')
a(href="?sort=" + sortby + "&t=day") past 24 hours
li(class=past === 'week' ? 'active' : '')
a(href="?sort=" + sortby + "&t=week") past week
li(class=past === 'month' ? 'active' : '')
a(href="?sort=" + sortby + "&t=month") past month
li(class=past === 'year' ? 'active' : '')
a(href="?sort=" + sortby + "&t=year") past year
li(class=past === 'all' ? 'active' : '')
a(href="?sort=" + sortby + "&t=all") all time
2021-01-09 13:29:57 +01:00
.info
2021-03-22 19:06:57 +01:00
img(src=data.icon_img)
2021-01-09 13:29:57 +01:00
h1 #{data.username}
p(class="user-stat") <span>#{kFormatter(data.link_karma)}</span> post karma
p(class="user-stat") <span>#{kFormatter(data.comment_karma)}</span> comment karma
br
p(title="" + toUTCString(data.created) + "") account created: #{toDateString(data.created)}
p verified: #{(data.verified) ? "yes" : "no" }
2021-05-24 20:39:28 +02:00
#links.entries
if !data.posts || data.posts.length <= 0
h3 no posts/comments
2020-11-17 21:44:32 +01:00
each post in data.posts
if post.type === 't3'
2021-05-24 20:39:28 +02:00
-
var link = post;
include components/link.pug
//-.entry.t3
//- .upvotes
//- .arrow
//- span #{kFormatter(post.ups)}
//- .arrow.down
//- .image
//- if post.thumbnail !== 'self'
//- a(href="" + post.permalink + "", rel="noopener noreferrer")
//- img(src="" + post.thumbnail + "", alt="")
//- if post.duration
//- span #{secondsToMMSS(post.duration)}
//- else
//- a(href="" + post.permalink + "", rel="noopener noreferrer")
//- .no-image no image
//- .title
//- a(href="" + post.permalink + "", rel="noopener noreferrer") #{cleanTitle(post.title)}
//- .meta
//- p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)}
//- | by
//- a(href="/u/" + data.username + "") #{data.username}
//- | to
//- != post.user_flair
//- a(href="/r/" + post.subreddit + "", class="subreddit") #{post.subreddit}
//- if post.over_18
//- span.tag.nsfw NSFW
//- a.comments(href="" + post.permalink + "") #{post.num_comments} comments
2020-11-17 21:44:32 +01:00
if post.type === 't1'
2021-05-24 20:39:28 +02:00
.commententry
2020-11-17 21:44:32 +01:00
.meta
.title
a(href="" + post.url + "", rel="noopener noreferrer") #{cleanTitle(post.link_title)}
2020-11-17 21:44:32 +01:00
.author
p by
if post.link_author === '[deleted]'
2020-11-17 21:44:32 +01:00
| [deleted]
else
a(href="/u/" + post.link_author + "") #{post.link_author}
2020-11-17 21:44:32 +01:00
.subreddit
p in
2020-12-21 12:27:31 +01:00
a(href="/r/" + post.subreddit + "") #{post.subreddit}
2020-11-17 21:44:32 +01:00
.comment
details(open="")
summary
a(href="/u/" + data.username + "") #{data.username}
p.ups #{post.ups} points
p.created(title="" + toUTCString(post.created) + "") #{timeDifference(post.created)}
.meta
p.author
a(href="/u/" + data.username + "") #{data.username}
2020-12-21 12:27:31 +01:00
p
!= post.user_flair
2020-11-17 21:44:32 +01:00
p.ups #{post.ups} points
p.created(title="" + toUTCString(post.created) + "") #{timeDifference(post.created)}
.body
2020-12-21 12:27:31 +01:00
div !{post.body_html}
2020-12-23 15:52:51 +01:00
if post.over_18
span.tag.nsfw NSFW
2020-11-17 21:44:32 +01:00
a.context(href="" + post.permalink + "?context=10") context
a.comments.t1(href="" + post.url + "") full comments (#{post.num_comments})
if data.before || data.after
p view more:
if data.before && !data.user_front
2021-05-21 18:43:19 +02:00
a(href="/u/" + data.username + data.post_type + (sortby === "new" ? "?" : "?sort=" + sortby + "&") + (!past ? "" : "t=" + past + "&") + "before=" + data.before + "") prev
2020-11-17 21:44:32 +01:00
if data.after
2021-05-21 18:43:19 +02:00
a(href="/u/" + data.username + data.post_type + (sortby === "new" ? "?" : "?sort=" + sortby + "&") + (!past ? "" : "t=" + past + "&") + "after=" + data.after + "") next
2020-12-28 21:45:17 +01:00
include includes/footer.pug