Implement a central link object

This commit is contained in:
StevenNMeza
2021-05-24 21:18:50 +02:00
parent ac14a7b094
commit 533519df65
7 changed files with 99 additions and 160 deletions
+1 -47
View File
@@ -137,53 +137,7 @@ html
span.tag.nsfw NSFW
a(href="/subreddits/search?q="+ q +"", class="btn") show more similar subreddits
each link in json.posts
.link
.upvotes
.arrow
span #{kFormatter(link.ups)}
.arrow.down
.image
if link.images
if link.is_self_link
a(href="" + link.permalink + "")
img(src="" + link.images.thumb + "", alt="")
else
a(href=""+ link.url +"", rel="noopener noreferrer")
img(src="" + link.images.thumb + "", alt="")
else
a(href="" + link.permalink + "")
.no-image no image
.entry
.title
if link.is_self_link
a(href="" + link.permalink + "")
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
!= link.link_flair
span (#{link.domain})
else
a(href="" + link.url + "", rel="noopener noreferrer")
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
!= link.link_flair
span (#{link.domain})
.meta
p.submitted submitted
span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by
if link.author === '[deleted]'
span(class="deleted") [deleted]
else
a(href="/u/" + link.author + "")
| #{link.author}
!= link.user_flair
p.to to
a(href="/r/" + link.subreddit + "")
| #{link.subreddit}
if link.stickied
span(class="green") stickied
.links
if link.over_18
span.tag.nsfw NSFW
a(href="" + link.permalink + "", class="comments")
| #{link.num_comments} comments
include components/link.pug
if json.before || json.after
.view-more-links
if json.before && !subreddit_front
-1
View File
@@ -84,7 +84,6 @@ html
if post.type === 't3'
-
var link = post;
link.author = data.username;
include components/link.pug
//-.entry.t3
//- .upvotes