2020-11-17 21:44:32 +01:00
|
|
|
|
doctype html
|
|
|
|
|
html
|
|
|
|
|
head
|
|
|
|
|
title teddit
|
|
|
|
|
include includes/head.pug
|
2021-01-27 17:39:12 +01:00
|
|
|
|
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
include includes/topbar.pug
|
|
|
|
|
if json === null
|
|
|
|
|
h2 error
|
|
|
|
|
p #{JSON.stringify(http_status_code)}
|
|
|
|
|
p #{JSON.stringify(http_statustext)}
|
|
|
|
|
else
|
2021-01-09 12:54:26 +01:00
|
|
|
|
- var subreddit = ''
|
|
|
|
|
if(user_preferences.subbed_subreddits && Array.isArray(user_preferences.subbed_subreddits))
|
|
|
|
|
- subreddit = '/r/' + user_preferences.subbed_subreddits.join('+')
|
2020-11-17 21:44:32 +01:00
|
|
|
|
header
|
|
|
|
|
a(href="/", class="main")
|
|
|
|
|
h1 teddit
|
|
|
|
|
.bottom
|
|
|
|
|
ul.tabmenu
|
|
|
|
|
li(class=!sortby || sortby == 'hot' ? 'active' : '')
|
2021-01-09 12:54:26 +01:00
|
|
|
|
a(href="" + subreddit + "/") hot
|
2020-11-17 21:44:32 +01:00
|
|
|
|
li(class=sortby === 'new' ? 'active' : '')
|
2021-01-09 12:54:26 +01:00
|
|
|
|
a(href="" + subreddit + "/new") new
|
2020-11-17 21:44:32 +01:00
|
|
|
|
li(class=sortby === 'rising' ? 'active' : '')
|
2021-01-09 12:54:26 +01:00
|
|
|
|
a(href="" + subreddit + "/rising") rising
|
2020-11-17 21:44:32 +01:00
|
|
|
|
li(class=sortby === 'controversial' ? 'active' : '')
|
2021-01-09 12:54:26 +01:00
|
|
|
|
a(href="" + subreddit + "/controversial") controversial
|
2020-11-17 21:44:32 +01:00
|
|
|
|
li(class=sortby === 'top' ? 'active' : '')
|
2021-01-09 12:54:26 +01:00
|
|
|
|
a(href="" + subreddit + "/top") top
|
2020-12-05 17:28:12 +01:00
|
|
|
|
if !before && !after && sortby === 'hot'
|
|
|
|
|
#intro
|
|
|
|
|
h1 Welcome to teddit
|
|
|
|
|
h2 the alternative, privacy respecting, front page of internet.
|
|
|
|
|
#links.sr
|
2020-11-17 21:44:32 +01:00
|
|
|
|
if sortby === 'top' || sortby === 'controversial'
|
|
|
|
|
details
|
|
|
|
|
summary
|
|
|
|
|
if past === 'hour'
|
|
|
|
|
span links from: past hour
|
2020-11-30 16:36:10 +01:00
|
|
|
|
if past === 'day'
|
|
|
|
|
span links from: past 24 hours
|
2020-11-17 21:44:32 +01:00
|
|
|
|
if past === 'week'
|
|
|
|
|
span links from: past week
|
|
|
|
|
if past === 'month'
|
|
|
|
|
span links from: past month
|
|
|
|
|
if past === 'year'
|
|
|
|
|
span links from: past year
|
|
|
|
|
if past === 'all'
|
|
|
|
|
span links from: all time
|
|
|
|
|
ul
|
|
|
|
|
li(class=past === 'hour' ? 'active' : '')
|
|
|
|
|
a(href="?t=hour") past hour
|
2020-11-30 16:36:10 +01:00
|
|
|
|
li(class=past === 'day' ? 'active' : '')
|
|
|
|
|
a(href="?t=day") past 24 hours
|
2020-11-17 21:44:32 +01:00
|
|
|
|
li(class=past === 'week' ? 'active' : '')
|
|
|
|
|
a(href="?t=week") past week
|
|
|
|
|
li(class=past === 'month' ? 'active' : '')
|
|
|
|
|
a(href="?t=month") past month
|
|
|
|
|
li(class=past === 'year' ? 'active' : '')
|
|
|
|
|
a(href="?t=year") past year
|
|
|
|
|
li(class=past === 'all' ? 'active' : '')
|
|
|
|
|
a(href="?t=all") all time
|
|
|
|
|
each link in json.links
|
|
|
|
|
.link
|
|
|
|
|
.upvotes
|
2020-12-30 22:51:20 +01:00
|
|
|
|
.arrow
|
2020-11-17 21:44:32 +01:00
|
|
|
|
span #{kFormatter(link.ups)}
|
2020-12-30 22:51:20 +01:00
|
|
|
|
.arrow.down
|
2020-11-17 21:44:32 +01:00
|
|
|
|
.image
|
|
|
|
|
if(link.images)
|
|
|
|
|
if link.is_self_link
|
|
|
|
|
a(href="" + link.permalink + "")
|
2020-12-05 17:31:31 +01:00
|
|
|
|
img(src=""+ link.images.thumb +"", alt="")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
else
|
2020-12-30 22:51:20 +01:00
|
|
|
|
a(href="" + link.url + "", rel="noopener noreferrer")
|
2020-12-05 17:31:31 +01:00
|
|
|
|
img(src=""+ link.images.thumb +"", alt="")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
else
|
|
|
|
|
a(href="" + link.permalink + "")
|
2020-12-30 22:51:20 +01:00
|
|
|
|
.no-image no image
|
2020-11-17 21:44:32 +01:00
|
|
|
|
.entry
|
|
|
|
|
.title
|
|
|
|
|
if link.is_self_link
|
|
|
|
|
a(href="" + link.permalink + "")
|
2020-12-02 17:02:32 +01:00
|
|
|
|
h2 #{cleanTitle(link.title)}
|
2020-11-17 21:44:32 +01:00
|
|
|
|
span (#{link.domain})
|
|
|
|
|
else
|
2020-12-30 22:51:20 +01:00
|
|
|
|
a(href="" + link.url + "", rel="noopener noreferrer")
|
2020-12-02 17:02:32 +01:00
|
|
|
|
h2 #{cleanTitle(link.title)}
|
2020-11-17 21:44:32 +01:00
|
|
|
|
span (#{link.domain})
|
|
|
|
|
.meta
|
|
|
|
|
p.submitted submitted
|
|
|
|
|
span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by
|
2020-12-14 15:08:38 +01:00
|
|
|
|
if link.author === '[deleted]'
|
|
|
|
|
span(class="deleted") [deleted]
|
|
|
|
|
else
|
|
|
|
|
a(href="/u/" + link.author + "")
|
|
|
|
|
| #{link.author}
|
2020-11-17 21:44:32 +01:00
|
|
|
|
span(class="to") to
|
|
|
|
|
a(href="/r/" + link.subreddit + "")
|
|
|
|
|
| #{link.subreddit}
|
2020-12-23 16:55:37 +01:00
|
|
|
|
.links
|
|
|
|
|
if link.over_18
|
|
|
|
|
span.tag.nsfw NSFW
|
2021-01-19 17:21:31 +01:00
|
|
|
|
if link.selftext_html
|
|
|
|
|
details
|
|
|
|
|
summary
|
|
|
|
|
.line
|
|
|
|
|
.line
|
|
|
|
|
.line
|
|
|
|
|
.selftext
|
|
|
|
|
!= unescape(link.selftext_html)
|
2021-01-24 12:54:13 +01:00
|
|
|
|
if (link.images && link.images.preview)
|
|
|
|
|
style.
|
|
|
|
|
details.preview-container img {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
height: auto !important;
|
|
|
|
|
max-width: none !important;
|
|
|
|
|
max-height: none !important;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
details.preview-container[open][data-url="#{link.images.preview}"] .preview {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: auto;
|
|
|
|
|
background-image: url('#{link.images.preview}');
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
background-size: contain;
|
|
|
|
|
}
|
|
|
|
|
details.preview-container(data-url="" + link.images.preview + "")
|
|
|
|
|
summary
|
|
|
|
|
span ▶
|
|
|
|
|
.preview
|
|
|
|
|
img(src=""+ link.images.thumb +"", alt="")
|
2021-02-06 20:17:36 +01:00
|
|
|
|
a(href="" + link.permalink + "", class="comments") #{link.num_comments} comments
|
|
|
|
|
-
|
|
|
|
|
let back_url = "/" + sortby + "§2t="+ (past ? past : '') +""
|
|
|
|
|
if(before && !subreddit_front)
|
|
|
|
|
back_url = "/" + sortby + "§2t="+ (past ? past : '') +"§1before=" + before + ""
|
|
|
|
|
if(after)
|
|
|
|
|
back_url = "/" + sortby + "§2t=" + (past ? past : '') + "§1after=" + after + ""
|
|
|
|
|
- let saved_post = false
|
|
|
|
|
if user_preferences.saved
|
|
|
|
|
each post_id in user_preferences.saved
|
|
|
|
|
if post_id === link.id
|
|
|
|
|
- saved_post = true
|
|
|
|
|
if saved_post
|
|
|
|
|
a(href="/unsave/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") unsave
|
|
|
|
|
else
|
|
|
|
|
a(href="/save/" + link.id + "/?rk=" + redis_key + "&b=" + back_url + "") save
|
2021-01-23 11:23:14 +01:00
|
|
|
|
if json.info.before || json.info.after
|
|
|
|
|
.view-more-links
|
|
|
|
|
- var subreddit = 'all'
|
|
|
|
|
if(user_preferences.subbed_subreddits && Array.isArray(user_preferences.subbed_subreddits))
|
|
|
|
|
- subreddit = user_preferences.subbed_subreddits.join('+')
|
|
|
|
|
if json.info.after
|
|
|
|
|
a(href="/r/" + subreddit + "/" + sortby + "?t=" + (past ? past : '') + "&after=" + json.info.after + "") next ›
|
2020-12-01 16:32:57 +01:00
|
|
|
|
#search
|
2020-11-17 21:44:32 +01:00
|
|
|
|
form(action="/r/all/search", method="GET")
|
2020-12-30 22:51:20 +01:00
|
|
|
|
div
|
|
|
|
|
label(for="q") search
|
|
|
|
|
input(type="text", name="q", id="q", placeholder="search")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
div
|
|
|
|
|
label(for="nsfw") include NSFW results
|
|
|
|
|
input(type="checkbox", name="nsfw", id="nsfw", checked="checked")
|
|
|
|
|
input(type="submit", value="search")
|
2021-01-24 12:54:13 +01:00
|
|
|
|
include includes/footer.pug
|