Merge pull request 'Add link flairs' (#64) from StevenNMeza/teddit:main into main

Reviewed-on: https://codeberg.org/teddit/teddit/pulls/64
This commit is contained in:
teddit 2020-12-13 21:23:03 +01:00
commit 91c7546bb0
5 changed files with 17 additions and 0 deletions

9
dist/css/styles.css vendored
View File

@ -785,6 +785,15 @@ input[type="submit"]:hover,
font-size: 12px; font-size: 12px;
margin-left: 10px; margin-left: 10px;
} }
.title .postflair {
display: inline-block;
border-radius: 4px;
padding: 1ch;
color: #dadada;
background-color: #6f6f6f;
font-size: 12px;
margin-left: 10px;
}
#post .submitted { #post .submitted {
font-size: small; font-size: small;
color: #686868; color: #686868;

View File

@ -18,6 +18,7 @@ module.exports = function(fetch) {
edited: post.edited, edited: post.edited,
is_video: post.is_video, is_video: post.is_video,
locked: post.locked, locked: post.locked,
link_flair_text: post.link_flair_text,
name: post_id, name: post_id,
num_comments: post.num_comments, num_comments: post.num_comments,
permalink: teddifyUrl(post.permalink), permalink: teddifyUrl(post.permalink),

View File

@ -60,6 +60,7 @@ module.exports = function() {
id: data.id, id: data.id,
images: images, images: images,
is_video: data.is_video, is_video: data.is_video,
link_flair_text: data.link_flair_text,
locked: data.locked, locked: data.locked,
media: data.media, media: data.media,
num_comments: data.num_comments, num_comments: data.num_comments,

View File

@ -23,6 +23,8 @@ html
.title .title
a(href="" + post.url + "") a(href="" + post.url + "")
h2 #{cleanTitle(post.title)} h2 #{cleanTitle(post.title)}
if post.link_flair_text
span(class="postflair") #{post.link_flair_text}
span(class="domain") (#{post.domain}) span(class="domain") (#{post.domain})
p.submitted p.submitted
span(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by span(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by

View File

@ -84,10 +84,14 @@ html
if link.is_self_link if link.is_self_link
a(href="" + link.permalink + "") a(href="" + link.permalink + "")
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
if link.link_flair_text
span(class="postflair") #{link.link_flair_text}
span (#{link.domain}) span (#{link.domain})
else else
a(href="" + link.url + "") a(href="" + link.url + "")
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)} h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
if link.link_flair_text
span(class="postflair") #{link.link_flair_text}
span (#{link.domain}) span (#{link.domain})
.meta .meta
p.submitted submitted p.submitted submitted